From de08244d40bf9588cd68788bc37977bc3d22108d Mon Sep 17 00:00:00 2001 From: Michael Babker Date: Wed, 29 May 2024 18:22:30 -0400 Subject: [PATCH] Add support for Symfony 7.1, drop Symfony 6.3 --- .github/workflows/run-tests.yml | 4 ++- .github/workflows/static-analysis.yml | 2 +- CHANGELOG.md | 5 ++++ composer.json | 30 +++++++++---------- docs/intro.md | 2 +- phpstan-baseline.neon | 5 ++++ .../RegisterPagerfantaViewsPassTest.php | 13 +++++++- .../Normalizer/PagerfantaNormalizerTest.php | 4 +-- 8 files changed, 44 insertions(+), 21 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 8cbc58e..9c1baef 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -10,7 +10,7 @@ jobs: fail-fast: true matrix: php: ['8.1', '8.2', '8.3'] - symfony: ['5.4.*', '6.3.*', '6.4.*', '7.0.*'] + symfony: ['5.4.*', '6.4.*', '7.0.*', '7.1.*@rc'] pagerfanta: [''] composer-flags: ['--prefer-stable'] can-fail: [false] @@ -30,6 +30,8 @@ jobs: exclude: - php: '8.1' symfony: '7.0.*' + - php: '8.1' + symfony: '7.1.*@rc' name: "PHP ${{ matrix.php }}${{ matrix.pagerfanta != '' && format(' - Pagerfanta {0}', matrix.pagerfanta) || '' }}${{ matrix.with-twig == false && ' - Without Twig' || '' }} - Symfony ${{ matrix.symfony }}${{ matrix.composer-flags != '' && format(' - Composer {0}', matrix.composer-flags) || '' }}" diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index a97174d..e8496c8 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -23,7 +23,7 @@ jobs: - name: Install dependencies run: composer update --prefer-stable --prefer-dist env: - SYMFONY_REQUIRE: '7.0.*' + SYMFONY_REQUIRE: '7.1.*@rc' - name: Run PHPStan run: vendor/bin/phpstan analyze --error-format=github diff --git a/CHANGELOG.md b/CHANGELOG.md index af34284..5918171 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,10 @@ # Changelog +## 4.5.0 (2024-??-??) + +- Add support for Symfony 7.1 +- Drop support for Symfony 6.3 + ## 4.4.0 (2023-12-20) - [#60](https://github.com/BabDev/PagerfantaBundle/pull/60) Added Basque locale diff --git a/composer.json b/composer.json index 5291b71..d817cec 100644 --- a/composer.json +++ b/composer.json @@ -8,12 +8,12 @@ "php": "^8.1", "pagerfanta/core": "^3.7 || ^4.0", "psr/container": "^1.0 || ^2.0", - "symfony/config": "^5.4 || ^6.3 || ^7.0", - "symfony/dependency-injection": "^5.4 || ^6.3 || ^7.0", - "symfony/http-foundation": "^5.4 || ^6.3 || ^7.0", - "symfony/http-kernel": "^5.4 || ^6.3 || ^7.0", - "symfony/property-access": "^5.4 || ^6.3 || ^7.0", - "symfony/routing": "^5.4 || ^6.3 || ^7.0" + "symfony/config": "^5.4 || ^6.4 || ^7.0", + "symfony/dependency-injection": "^5.4 || ^6.4 || ^7.0", + "symfony/http-foundation": "^5.4 || ^6.4 || ^7.0", + "symfony/http-kernel": "^5.4 || ^6.4 || ^7.0", + "symfony/property-access": "^5.4 || ^6.4 || ^7.0", + "symfony/routing": "^5.4 || ^6.4 || ^7.0" }, "require-dev": { "jms/serializer": "^3.18", @@ -25,21 +25,21 @@ "phpstan/phpstan-phpunit": "1.4.0", "phpstan/phpstan-symfony": "1.4.1", "phpunit/phpunit": "9.6.19", - "symfony/phpunit-bridge": "^5.4 || ^6.3 || ^7.0", - "symfony/serializer": "^5.4 || ^6.3 || ^7.0", - "symfony/twig-bridge": "^5.4 || ^6.3 || ^7.0", - "symfony/twig-bundle": "^5.4 || ^6.3 || ^7.0", - "symfony/translation": "^5.4 || ^6.3 || ^7.0", + "symfony/phpunit-bridge": "^5.4 || ^6.4 || ^7.0", + "symfony/serializer": "^5.4 || ^6.4 || ^7.0", + "symfony/twig-bridge": "^5.4 || ^6.4 || ^7.0", + "symfony/twig-bundle": "^5.4 || ^6.4 || ^7.0", + "symfony/translation": "^5.4 || ^6.4 || ^7.0", "twig/twig": "^2.13 || ^3.0" }, "conflict": { "jms/serializer": "<3.18", "jms/serializer-bundle": "<4.2", "pagerfanta/twig": "<3.7", - "symfony/serializer": "<5.4 || >=6.0,<6.3", - "symfony/translation": "<5.4 || >=6.0,<6.3", - "symfony/twig-bridge": "<5.4 || >=6.0,<6.3", - "symfony/twig-bundle": "<5.4 || >=6.0,<6.3", + "symfony/serializer": "<5.4 || >=6.0,<6.4", + "symfony/translation": "<5.4 || >=6.0,<6.4", + "symfony/twig-bridge": "<5.4 || >=6.0,<6.4", + "symfony/twig-bundle": "<5.4 || >=6.0,<6.4", "twig/twig": "<2.13", "white-october/pagerfanta-bundle": "*" }, diff --git a/docs/intro.md b/docs/intro.md index 0a30e85..438f3a3 100644 --- a/docs/intro.md +++ b/docs/intro.md @@ -25,6 +25,6 @@ The below table shows the supported PHP and Symfony versions for this bundle. No |---------|-------------------------|--------------|-------------------| | 2.x | **No Longer Supported** | 7.2-8.0 | 3.4, 4.4, 5.3-5.4 | | 3.x | Actively Supported | 7.4-8.2 | 4.4, 5.4, 6.0-6.4 | -| 4.x | Actively Supported | 8.1+ | 5.4, 6.3-6.4, 7.0 | +| 4.x | Actively Supported | 8.1+ | 5.4, 6.4, 7.0-7.1 |
When a maximum PHP version is listed, that is the highest version that is tested for support. The bundle may work on newer PHP versions, but support is not guaranteed.
diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index b153e05..0aa8add 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -5,6 +5,11 @@ parameters: count: 2 path: src/RouteGenerator/RequestAwareRouteGeneratorFactory.php + - + message: "#^Parameter \\#2 \\$parameters of method Symfony\\\\Component\\\\Routing\\\\Generator\\\\UrlGeneratorInterface\\:\\:generate\\(\\) expects array, array\\|object given\\.$#" + count: 1 + path: src/RouteGenerator/RouterAwareRouteGenerator.php + - message: "#^Method BabDev\\\\PagerfantaBundle\\\\View\\\\ContainerBackedImmutableViewFactory\\:\\:get\\(\\) should return Pagerfanta\\\\View\\\\ViewInterface but returns mixed\\.$#" count: 1 diff --git a/tests/DependencyInjection/CompilerPass/RegisterPagerfantaViewsPassTest.php b/tests/DependencyInjection/CompilerPass/RegisterPagerfantaViewsPassTest.php index 1f79cf7..a8f8e5d 100644 --- a/tests/DependencyInjection/CompilerPass/RegisterPagerfantaViewsPassTest.php +++ b/tests/DependencyInjection/CompilerPass/RegisterPagerfantaViewsPassTest.php @@ -4,6 +4,7 @@ use BabDev\PagerfantaBundle\DependencyInjection\CompilerPass\RegisterPagerfantaViewsPass; use BabDev\PagerfantaBundle\View\ContainerBackedImmutableViewFactory; +use Composer\InstalledVersions; use Matthias\SymfonyDependencyInjectionTest\PhpUnit\AbstractCompilerPassTestCase; use Pagerfanta\View\DefaultView; use Pagerfanta\View\ViewFactory; @@ -40,10 +41,20 @@ public function testViewsAreAddedToTheContainerBackedViewFactory(): void $this->compile(); $this->assertContainerBuilderHasService('pagerfanta.view.default', DefaultView::class); + + // The locator ID is different at Symfony 7.1 + $version = InstalledVersions::getVersion('symfony/dependency-injection'); + + if (null === $version) { + self::fail('Could not detect installed version of symfony/dependency-injection'); + } + + $locatorId = version_compare($version, '7.1', '>=') ? '.service_locator.mde9.qA' : '.service_locator.3Jj7I65'; + $this->assertContainerBuilderHasServiceDefinitionWithArgument( 'pagerfanta.view_factory', 0, - new Reference('.service_locator.3Jj7I65'), + new Reference($locatorId), ); $this->assertContainerBuilderHasServiceDefinitionWithArgument( 'pagerfanta.view_factory', diff --git a/tests/Serializer/Normalizer/PagerfantaNormalizerTest.php b/tests/Serializer/Normalizer/PagerfantaNormalizerTest.php index cac7adc..91bd56a 100644 --- a/tests/Serializer/Normalizer/PagerfantaNormalizerTest.php +++ b/tests/Serializer/Normalizer/PagerfantaNormalizerTest.php @@ -44,7 +44,7 @@ public function testNormalize(): void public function testNormalizeWithLegacyDecorator(): void { if (!interface_exists(CacheableSupportsMethodInterface::class)) { - self::markTestSkipped('Test requires symfony/serializer:<6.4'); + self::markTestSkipped('Test requires symfony/serializer:<=6.4'); } $pager = new Pagerfanta( @@ -96,7 +96,7 @@ public function testSupportsNormalization(mixed $data, bool $supported): void public function testHasCacheableSupportsMethod(): void { if (!interface_exists(CacheableSupportsMethodInterface::class)) { - self::markTestSkipped('Test requires symfony/serializer:<6.4'); + self::markTestSkipped('Test requires symfony/serializer:<=6.4'); } self::assertTrue((new LegacyPagerfantaNormalizer(new PagerfantaNormalizer()))->hasCacheableSupportsMethod());