From 470377b64a71d5c26490e3efe564f4daadd9b851 Mon Sep 17 00:00:00 2001 From: Olivier Laviale Date: Sat, 11 Jan 2025 12:16:15 +0100 Subject: [PATCH] Require PHP 8.4+ --- .editorconfig | 8 +- .github/workflows/code-style.yml | 6 +- .github/workflows/static-analysis.yml | 8 +- .github/workflows/test.yml | 11 ++- CHANGELOG.md | 47 +++++++++++ Dockerfile | 50 +++++++----- MIGRATION.md | 23 ------ Makefile | 23 ++---- README.md | 25 +++--- composer.json | 94 +++++++++++----------- docker-compose.yaml | 16 +--- phpcs.xml | 4 +- phpstan.neon | 1 + phpunit.xml | 33 +++++--- tests/Application.php | 16 ---- tests/{repository => var}/cache/.gitignore | 0 16 files changed, 182 insertions(+), 183 deletions(-) create mode 100644 CHANGELOG.md delete mode 100644 MIGRATION.md delete mode 100644 tests/Application.php rename tests/{repository => var}/cache/.gitignore (100%) diff --git a/.editorconfig b/.editorconfig index 33b8d84..c11eed3 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,5 +8,11 @@ insert_final_newline = true indent_style = space indent_size = 4 -[{*.yaml,*yml,*.neon}] +[{*.yaml,*.yml,*.neon,*.json}] indent_size = 2 + +[*.md] +max_line_length = 100 + +[{Dockerfile,Makefile}] +indent_style = tab diff --git a/.github/workflows/code-style.yml b/.github/workflows/code-style.yml index d2b81c1..ce3b7e8 100644 --- a/.github/workflows/code-style.yml +++ b/.github/workflows/code-style.yml @@ -6,15 +6,15 @@ on: jobs: phpcs: - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 with: coverage: none - php-version: "8.1" + php-version: "8.4" ini-values: memory_limit=-1 tools: phpcs, cs2pr - name: Run PHP Code Sniffer diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 3b5da94..5cc3b12 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -7,18 +7,18 @@ on: jobs: phpstan: name: phpstan - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 with: - php-version: "8.1" + php-version: "8.4" ini-values: memory_limit=-1 tools: composer:v2 - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.composer/cache diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fa2121a..b591f62 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -7,15 +7,14 @@ on: jobs: phpunit: name: phpunit - runs-on: ubuntu-20.04 + runs-on: ubuntu-latest strategy: matrix: php-version: - - "8.1" - - "8.2" + - "8.4" steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Install PHP uses: shivammathur/setup-php@v2 with: @@ -24,7 +23,7 @@ jobs: ini-values: memory_limit=-1 tools: composer:v2 - name: Cache dependencies - uses: actions/cache@v2 + uses: actions/cache@v4 with: path: | ~/.composer/cache @@ -39,7 +38,7 @@ jobs: run: make test-coveralls - name: Upload code coverage - if: ${{ matrix.php-version == '8.1' }} + if: ${{ matrix.php-version == '8.4' }} env: COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..71d2a7e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,47 @@ +# CHANGELOG + +## v7.x + +### New Requirements + +PHP 8.4+ + +### New features + +None + +### Backward Incompatible Changes + +None + +### Deprecated Features + +None + +### Other Changes + +None + + + +## v6.x + +### New Requirements + +PHP 8.2+ + +### New features + +None + +### Backward Incompatible Changes + +None + +### Deprecated Features + +None + +### Other Changes + +None diff --git a/Dockerfile b/Dockerfile index 7ea4381..4b767e9 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,38 @@ -ARG PHP_VERSION -FROM php:${PHP_VERSION}-cli-buster +ARG PHP_VERSION=8.4 +FROM php:${PHP_VERSION}-cli-bookworm -RUN apt-get update && \ - apt-get install -y autoconf pkg-config && \ - pecl channel-update pecl.php.net && \ - pecl install xdebug && \ +RUN <<-EOF + apt-get update + apt-get install -y autoconf pkg-config + pecl channel-update pecl.php.net + pecl install xdebug docker-php-ext-enable opcache xdebug +EOF -RUN echo '\ -xdebug.client_host=host.docker.internal\n\ -xdebug.mode=develop\n\ -xdebug.start_with_request=yes\n\ -' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini +RUN <<-EOF + cat <<-SHELL >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini + xdebug.client_host=host.docker.internal + xdebug.mode=develop + xdebug.start_with_request=yes + SHELL -RUN echo '\ -display_errors=On\n\ -error_reporting=E_ALL\n\ -date.timezone=UTC\n\ -' >> /usr/local/etc/php/conf.d/php.ini + cat <<-SHELL >> /usr/local/etc/php/conf.d/php.ini + display_errors=On + error_reporting=E_ALL + date.timezone=UTC + SHELL +EOF ENV COMPOSER_ALLOW_SUPERUSER 1 -RUN apt-get update && \ - apt-get install unzip && \ - curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet && \ - mv composer.phar /usr/local/bin/composer && \ - echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"\n' >> /root/.bashrc +RUN <<-EOF + apt-get update + apt-get install unzip + curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet + mv composer.phar /usr/local/bin/composer + cat <<-SHELL >> /root/.bashrc + export PATH="$HOME/.composer/vendor/bin:$PATH" + SHELL +EOF RUN composer global require squizlabs/php_codesniffer diff --git a/MIGRATION.md b/MIGRATION.md deleted file mode 100644 index c421e8a..0000000 --- a/MIGRATION.md +++ /dev/null @@ -1,23 +0,0 @@ -# Migration - -## v5.x to v6.x - -### New Requirements - -None - -### New features - -None - -### Backward Incompatible Changes - -None - -### Deprecated Features - -None - -### Other Changes - -None diff --git a/Makefile b/Makefile index 96eb2bc..e410c11 100644 --- a/Makefile +++ b/Makefile @@ -1,24 +1,20 @@ # customization -PACKAGE_NAME = icanboogie/bind-view PHPUNIT = vendor/bin/phpunit # do not edit the following lines -.PHONY: usage -usage: - @echo "test: Runs the test suite.\ndoc: Creates the documentation.\nclean: Removes the documentation, the dependencies and the Composer files." - vendor: @composer install # testing +.PHONY: test-dependencies test-dependencies: vendor .PHONY: test test: test-dependencies - @$(PHPUNIT) + @$(PHPUNIT) $(ARGS) .PHONY: test-coverage test-coverage: test-dependencies @@ -31,17 +27,12 @@ test-coveralls: test-dependencies @XDEBUG_MODE=coverage $(PHPUNIT) --coverage-clover ../build/logs/clover.xml .PHONY: test-container -test-container: test-container-81 - -.PHONY: test-container-81 -test-container-81: - @-docker-compose run --rm app81 bash - @docker-compose down -v +test-container: test-container-84 -.PHONY: test-container-82 -test-container-82: - @-docker-compose run --rm app82 bash - @docker-compose down -v +.PHONY: test-container-84 +test-container-84: + @-docker compose run --rm app84 bash + @docker compose down -v .PHONY: lint lint: diff --git a/README.md b/README.md index 32f5d09..6150be5 100644 --- a/README.md +++ b/README.md @@ -1,20 +1,19 @@ # bind-view [![Release](https://img.shields.io/packagist/v/icanboogie/bind-view.svg)](https://packagist.org/packages/icanboogie/bind-view) -[![Code Quality](https://img.shields.io/scrutinizer/g/ICanBoogie/bind-view.svg)](https://scrutinizer-ci.com/g/ICanBoogie/bind-view) -[![Code Coverage](https://img.shields.io/coveralls/ICanBoogie/bind-view.svg)](https://coveralls.io/r/ICanBoogie/bind-view) +[![Code Coverage](https://coveralls.io/repos/github/ICanBoogie/bind-view/badge.svg?branch=7.0)](https://coveralls.io/r/ICanBoogie/bind-view?branch=7.0) [![Downloads](https://img.shields.io/packagist/dt/icanboogie/bind-view.svg)](https://packagist.org/packages/icanboogie/bind-view) The **icanboogie/bind-view** package binds [icanboogie/view][] to [ICanBoogie][], using its -autoconfig feature. It add getters to controllers and views, making it easy to invoke views from -controller actions or obtain template engines and resolve templates from views, using features +autoconfig feature. It adds getters to controllers and views, making it easy to invoke views from +controller actions or get template engines and resolve templates from views, using features of [icanboogie/render][]. #### Installation -```bash +```shell composer require icanboogie/bind-view ``` @@ -66,28 +65,22 @@ For more information continue to the [View documentation](https://github.com/ICa The project is continuously tested by [GitHub actions](https://github.com/ICanBoogie/bind-view/actions). -[![Tests](https://github.com/ICanBoogie/bind-view/workflows/test/badge.svg?branch=master)](https://github.com/ICanBoogie/bind-view/actions?query=workflow%3Atest) -[![Static Analysis](https://github.com/ICanBoogie/bind-view/workflows/static-analysis/badge.svg?branch=master)](https://github.com/ICanBoogie/bind-view/actions?query=workflow%3Astatic-analysis) -[![Code Style](https://github.com/ICanBoogie/bind-view/workflows/code-style/badge.svg?branch=master)](https://github.com/ICanBoogie/bind-view/actions?query=workflow%3Acode-style) +[![Tests](https://github.com/ICanBoogie/bind-view/actions/workflows/test.yml/badge.svg?branch=7.0)](https://github.com/ICanBoogie/bind-view/actions/workflows/test.yml) +[![Static Analysis](https://github.com/ICanBoogie/bind-view/actions/workflows/static-analysis.yml/badge.svg?branch=7.0)](https://github.com/ICanBoogie/bind-view/actions/workflows/static-analysis.yml) +[![Code Style](https://github.com/ICanBoogie/bind-view/actions/workflows/code-style.yml/badge.svg?branch=7.0)](https://github.com/ICanBoogie/bind-view/actions/workflows/code-style.yml) ## Code of Conduct This project adheres to a [Contributor Code of Conduct](CODE_OF_CONDUCT.md). By participating in -this project and its community, you are expected to uphold this code. +this project and its community, you're expected to uphold this code. ## Contributing -Please see [CONTRIBUTING](CONTRIBUTING.md) for details. - - - -## License - -**icanboogie/bind-view** is released under the [BSD-3-Clause](LICENSE). +See [CONTRIBUTING](CONTRIBUTING.md) for details. diff --git a/composer.json b/composer.json index 1672a1a..3efac72 100644 --- a/composer.json +++ b/composer.json @@ -1,51 +1,47 @@ { - "name": "icanboogie/bind-view", - "type": "library", - "description": "Binds icanboogie/view to ICanBoogie", - "homepage": "https://icanboogie.org/", - "license": "BSD-3-Clause", - "authors": [ - { - "name": "Olivier Laviale", - "email": "olivier.laviale@gmail.com", - "homepage": "https://olvlvl.com/", - "role": "Developer" - } - ], - "support": { - "issues": "https://github.com/ICanBoogie/bind-view/issues", - "source": "https://github.com/ICanBoogie/bind-view" - }, - "config": { - "sort-packages": true - }, - "minimum-stability": "dev", - "prefer-stable": true, - "prefer-dist": true, - "require": { - "php": ">=8.1", - "icanboogie/icanboogie": "^6.0", - "icanboogie/bind-render": "^6.0", - "icanboogie/view": "^6.0" - }, - "require-dev": { - "phpstan/phpstan": "^1.6", - "phpunit/phpunit": "^9.5" - }, - "autoload-dev": { - "psr-4": { - "Test\\ICanBoogie\\Binding\\View\\": "tests/lib" - }, - "classmap": [ - "tests/Application.php" - ] - }, - "scripts": { - "post-autoload-dump": "ICanBoogie\\Autoconfig\\Hooks::on_autoload_dump" - }, - "extra": { - "icanboogie": { - "config-path": "config" - } - } + "name": "icanboogie/bind-view", + "type": "library", + "description": "Binds icanboogie/view to ICanBoogie", + "homepage": "https://icanboogie.org/", + "license": "BSD-3-Clause", + "authors": [ + { + "name": "Olivier Laviale", + "email": "olivier.laviale@gmail.com", + "homepage": "https://olvlvl.com/", + "role": "Developer" + } + ], + "support": { + "issues": "https://github.com/ICanBoogie/bind-view/issues", + "source": "https://github.com/ICanBoogie/bind-view" + }, + "config": { + "sort-packages": true, + "allow-plugins": { + "icanboogie/autoconfig": true + } + }, + "minimum-stability": "dev", + "prefer-stable": true, + "require": { + "php": ">=8.4", + "icanboogie/icanboogie": "^7.0", + "icanboogie/bind-render": "^7.0", + "icanboogie/view": "^7.0" + }, + "require-dev": { + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^11.5" + }, + "autoload-dev": { + "psr-4": { + "Test\\ICanBoogie\\Binding\\View\\": "tests/lib" + } + }, + "extra": { + "icanboogie": { + "config-path": "config" + } + } } diff --git a/docker-compose.yaml b/docker-compose.yaml index 5885057..5506a72 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -1,22 +1,10 @@ --- -version: "3.2" services: - app81: + app84: build: context: . args: - PHP_VERSION: 8.1 - environment: - PHP_IDE_CONFIG: 'serverName=icanboogie-bind-view' - volumes: - - .:/app:delegated - - ~/.composer:/root/.composer:delegated - working_dir: /app - app82: - build: - context: . - args: - PHP_VERSION: 8.2 + PHP_VERSION: "8.4" environment: PHP_IDE_CONFIG: 'serverName=icanboogie-bind-view' volumes: diff --git a/phpcs.xml b/phpcs.xml index 1be23c8..2dbb0bd 100644 --- a/phpcs.xml +++ b/phpcs.xml @@ -3,9 +3,9 @@ xsi:noNamespaceSchemaLocation="https://raw.githubusercontent.com/squizlabs/PHP_CodeSniffer/master/phpcs.xsd"> lib tests - tests/repository/* + tests/var/* - + diff --git a/phpstan.neon b/phpstan.neon index f638b07..ab70e2b 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,4 @@ +# $schema: https://phpstan.olvlvl.com/schema.json parameters: level: max paths: diff --git a/phpunit.xml b/phpunit.xml index 3a7de3c..300a129 100644 --- a/phpunit.xml +++ b/phpunit.xml @@ -1,15 +1,24 @@ - - - ./lib - - - - - ./tests - - + xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.5/phpunit.xsd" + beStrictAboutCoverageMetadata="true" + beStrictAboutOutputDuringTests="true" + bootstrap="tests/bootstrap.php" + colors="true" + displayDetailsOnTestsThatTriggerDeprecations="true" + displayDetailsOnTestsThatTriggerNotices="true" + displayDetailsOnTestsThatTriggerWarnings="true" + displayDetailsOnPhpunitDeprecations="true" + executionOrder="depends,defects" +> + + + tests/src + + + + + src + + diff --git a/tests/Application.php b/tests/Application.php deleted file mode 100644 index 998ea2c..0000000 --- a/tests/Application.php +++ /dev/null @@ -1,16 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace ICanBoogie; - -class Application extends ApplicationAbstract -{ -} diff --git a/tests/repository/cache/.gitignore b/tests/var/cache/.gitignore similarity index 100% rename from tests/repository/cache/.gitignore rename to tests/var/cache/.gitignore