From 297a7dc9a230978ac76c4187abb6356ebfa01574 Mon Sep 17 00:00:00 2001 From: chapterjason Date: Wed, 15 Dec 2021 09:52:32 +0100 Subject: [PATCH] Allow PHP 8.1 and Symfony 6.1 (#66) * feat: Allow php 8.1 and symfony 6.1 * ci: Set php to 8.1 for static workflow * ci: Add php 8.1 and symfony 6.1 to test workflow * Revert "ci: Set php to 8.1 for static workflow" This reverts commit 94932d072209c69e24cf880d4ddc5e8a814dadef. * ci: Update phpstan * ci: Update phpstan baseline * ci: Update psalm baseline * ci: Add symfony 5.4 * fix: Add conflict with phpunit lower or equal to 8.5.14 Cause of GLOBALS access and compatibility with PHP 8.1 * chore: fix order in composer * chore: Update readme and changelog * docs: Update pipeline example in README * fix: Update constraints in composer file * fix: Normalize composer json * chore: Fix phpstan baseline --- .github/workflows/ci.yml | 19 +++++++++++++++++-- .github/workflows/static.yml | 2 +- CHANGELOG.md | 2 ++ README.md | 4 ++-- composer.json | 11 +++++++---- phpstan-baseline.neon | 12 +++++++++++- psalm.baseline.xml | 5 +++++ 7 files changed, 45 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4d15b31..3b3cef8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,29 +12,44 @@ jobs: - '7.3' - '7.4' - '8.0' + - '8.1' dependency: - '' - 'lowest' symfony: - '4.4.*' - '5.3.*' + - '5.4.*' - '6.0.*' + - '6.1.*' exclude: - php: '7.2' symfony: '4.4.*' dependency: 'lowest' - php: '7.2' symfony: '6.0.*' + - php: '7.2' + symfony: '6.1.*' - php: '7.3' symfony: '4.4.*' - php: '7.3' symfony: '6.0.*' + - php: '7.3' + symfony: '6.1.*' - php: '7.4' symfony: '4.4.*' - php: '7.4' symfony: '6.0.*' + - php: '7.4' + symfony: '6.1.*' - php: '8.0' symfony: '4.4.*' + - php: '8.1' + symfony: '4.4.*' + dependency: 'lowest' + - php: '8.1' + symfony: '5.3.*' + dependency: 'lowest' fail-fast: false steps: - name: Checkout @@ -50,8 +65,8 @@ jobs: - name: Configure Symfony run: composer config extra.symfony.require "${{ matrix.symfony }}" - - name: Prefer unstable Composer dependencies if Symfony 6.0 - if: matrix.symfony == '6.0.*' + - name: Prefer unstable Composer dependencies if Symfony 6.1 + if: matrix.symfony == '6.1.*' run: composer config prefer-stable false - name: Get Composer Cache Directory diff --git a/.github/workflows/static.yml b/.github/workflows/static.yml index 3957e37..0025c38 100644 --- a/.github/workflows/static.yml +++ b/.github/workflows/static.yml @@ -15,7 +15,7 @@ jobs: with: php-version: 8.0 coverage: none - tools: phpstan:0.12.94, cs2pr + tools: phpstan:1.2.0, cs2pr - name: Download dependencies uses: ramsey/composer-install@v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 929f9fd..9c00c3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,8 @@ The change log describes what is "Added", "Removed", "Changed" or "Fixed" betwee - Support for multiple routing files via `TestKernel::addRoutingFile` - Support for a fully functional symfony kernel with the usage of the `Symfony\Bundle\FrameworkBundle\Kernel\MicroKernelTrait` - Cleanup of the cache and log directory after kernel shutdown +- Support for PHP 8.1 +- Support for Symfony 6.1 ### Removed diff --git a/README.md b/README.md index f49887f..8023a16 100644 --- a/README.md +++ b/README.md @@ -102,8 +102,8 @@ jobs: strategy: matrix: operating-system: [ ubuntu-latest, windows-latest ] - php: [ '7.4', '8.0' ] - symfony: ['^4.4', '^5.3'] + php: [ '7.4', '8.0', '8.1' ] + symfony: ['4.4.*', '5.3.*', '5.4.*', '6.0.*', '6.1.*'] steps: - uses: actions/checkout@master diff --git a/composer.json b/composer.json index cf9bca1..24651b6 100644 --- a/composer.json +++ b/composer.json @@ -1,8 +1,8 @@ { "name": "nyholm/symfony-bundle-test", - "type": "library", "description": "", "license": "MIT", + "type": "library", "authors": [ { "name": "Tobias Nyholm", @@ -10,7 +10,7 @@ } ], "require": { - "php": "^7.2 || ^8.0", + "php": "^7.2 || ^8.0 || ^8.1", "symfony/dependency-injection": "^4.4 || ^5.3 || ^6.0", "symfony/filesystem": "^4.4 || ^5.3 || ^6.0", "symfony/framework-bundle": "^4.4 || ^5.3 || ^6.0", @@ -20,6 +20,11 @@ "require-dev": { "phpunit/phpunit": "^8.5 || ^9.4" }, + "conflict": { + "phpunit/phpunit": "<=8.5.14" + }, + "minimum-stability": "dev", + "prefer-stable": true, "autoload": { "psr-4": { "Nyholm\\BundleTest\\": "src/" @@ -30,8 +35,6 @@ "Nyholm\\BundleTest\\Tests\\": "tests/" } }, - "minimum-stability": "dev", - "prefer-stable": true, "scripts": { "test": "vendor/bin/phpunit", "test-ci": "vendor/bin/phpunit --coverage-text --coverage-clover=build/coverage.xml" diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index bb603e8..6e924ad 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,7 +1,17 @@ parameters: ignoreErrors: - - message: "#^Comparison operation \"\\>\\=\" between 50306 and 50100 is always true\\.$#" + message: "#^Call to method import\\(\\) on an unknown class Symfony\\\\Component\\\\Routing\\\\RouteCollectionBuilder\\.$#" + count: 1 + path: src/TestKernel.php + + - + message: "#^Parameter \\$routes of method Nyholm\\\\BundleTest\\\\TestKernel\\:\\:configureRoutes\\(\\) has invalid type Symfony\\\\Component\\\\Routing\\\\RouteCollectionBuilder\\.$#" + count: 1 + path: src/TestKernel.php + + - + message: "#^Comparison operation \"\\>\\=\" between 60001 and 50100 is always true\\.$#" count: 1 path: src/config/parameters.php diff --git a/psalm.baseline.xml b/psalm.baseline.xml index 38f6696..dc27547 100644 --- a/psalm.baseline.xml +++ b/psalm.baseline.xml @@ -1,5 +1,10 @@ + + + RoutingConfigurator|RouteCollectionBuilder + + $container