From 9ed94dd968f172e946cdb12357c1051d5ccd0d2a Mon Sep 17 00:00:00 2001 From: Teddy Sommavilla Date: Mon, 21 Sep 2026 14:53:07 +0200 Subject: [PATCH] chore(deps): support symfony 7 Widens the Symfony constraints to `^6.4 || ^7.0` and raises the PHP floor to 8.2, which is what Symfony 7 needs. The bundle code was already compatible: the extension extends the DependencyInjection `Extension` (not the moved HttpKernel one), the listener uses `ResponseEvent`/`isMainRequest()`, and services are declared through `ContainerConfigurator`. Three things had to be fixed to get CI green, all caused by the unpinned dev dependencies that `composer update` resolves to their latest: - phpcs has been failing on main since slevomat 8.x renamed the `DeclareStrictTypes` properties to `linesCount*`. - the blanket `@phpstan-ignore-next-line` in `Configuration` is unmatched on Symfony 7, where `getRootNode()` is documented as returning an `ArrayNodeDefinition`. Replaced with an explicit assert. - the test matrix now runs 8.2/8.3/8.4, but only pairs `--prefer-lowest` with 8.2: the lowest allowed Symfony brings in a symfony/cache that is not PHP 8.4 clean, and no consumer will ever hit that combination. Co-Authored-By: Claude Opus 5 --- .github/workflows/analysis.yaml | 6 +++--- .github/workflows/tests.yaml | 10 +++++++--- CHANGELOG.md | 15 ++++++++++++++- composer.json | 10 +++++----- phpcs.xml.dist | 4 ++-- phpstan.neon | 1 + src/DependencyInjection/Configuration.php | 6 ++++-- 7 files changed, 36 insertions(+), 16 deletions(-) diff --git a/.github/workflows/analysis.yaml b/.github/workflows/analysis.yaml index 0c42982..38eef4c 100644 --- a/.github/workflows/analysis.yaml +++ b/.github/workflows/analysis.yaml @@ -4,18 +4,18 @@ jobs: parallel-lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: composer update --no-interaction --no-progress --prefer-dist --ansi - run: ./vendor/bin/parallel-lint --colors ./src ./tests phpcs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: composer update --no-interaction --no-progress --prefer-dist --ansi - run: ./vendor/bin/phpcs --colors phpstan: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - run: composer update --no-interaction --no-progress --prefer-dist --ansi - run: ./vendor/bin/phpstan analyse --no-progress --ansi diff --git a/.github/workflows/tests.yaml b/.github/workflows/tests.yaml index eecee33..4ae0f32 100644 --- a/.github/workflows/tests.yaml +++ b/.github/workflows/tests.yaml @@ -5,10 +5,14 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - php-version: [8.1] - composer-flags: [null, --prefer-lowest] + php-version: ["8.2", "8.3", "8.4"] + composer-flags: [null] + include: + # The lowest allowed dependency set only needs to hold on the lowest supported PHP. + - php-version: "8.2" + composer-flags: --prefer-lowest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 - uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php-version }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ae5a68..b9c66cf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] _In progress…_ +## [2.1.0] - 2026-09-21 +### Added +- Support for Symfony 7. + +### Changed +- Minimum supported versions are now PHP 8.2 and Symfony 6.4. + +## [2.0.0] - 2022-08-29 +### Changed +- Support Symfony 6 and PHP 8, dropping Symfony 4/5 and PHP 7. + ## [1.1.1] - 2021-07-16 ### Fixed - Add missing support for `replace` in the configuration. @@ -19,7 +30,9 @@ _In progress…_ ## [1.0.0] - 2020-10-02 First release. -[Unreleased]: https://github.com/BatchLabs/headers-bundle/compare/v1.1.1...HEAD +[Unreleased]: https://github.com/BatchLabs/headers-bundle/compare/2.1.0...HEAD +[2.1.0]: https://github.com/BatchLabs/headers-bundle/compare/2.0.0...2.1.0 +[2.0.0]: https://github.com/BatchLabs/headers-bundle/compare/1.1.1...2.0.0 [1.1.1]: https://github.com/BatchLabs/headers-bundle/compare/v1.1.0...v1.1.1 [1.1.0]: https://github.com/BatchLabs/headers-bundle/compare/v1.0.0...v1.1.0 [1.0.0]: https://github.com/BatchLabs/headers-bundle/releases/tag/v1.0.0 diff --git a/composer.json b/composer.json index 0335e1d..d21f3b9 100644 --- a/composer.json +++ b/composer.json @@ -3,11 +3,11 @@ "description": "A Symfony bundle to easily add headers to your responses.", "type": "symfony-bundle", "require": { - "php": "^8.0", - "symfony/http-kernel": "^6.0", - "symfony/dependency-injection": "^6.0", - "symfony/config": "^6.0", - "symfony/expression-language": "^6.0", + "php": "^8.2", + "symfony/http-kernel": "^6.4 || ^7.0", + "symfony/dependency-injection": "^6.4 || ^7.0", + "symfony/config": "^6.4 || ^7.0", + "symfony/expression-language": "^6.4 || ^7.0", "psr/cache": "^3.0" }, "require-dev": { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 7c01ebc..2af7a72 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -13,8 +13,8 @@ - - + + diff --git a/phpstan.neon b/phpstan.neon index 48fadce..686d0d8 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -14,3 +14,4 @@ parameters: checkMissingIterableValueType: false checkGenericClassInNonGenericObjectType: false inferPrivatePropertyTypeFromConstructor: true + treatPhpDocTypesAsCertain: false diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 878e463..befbc0a 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -4,6 +4,7 @@ namespace Batch\HeadersBundle\DependencyInjection; +use Symfony\Component\Config\Definition\Builder\ArrayNodeDefinition; use Symfony\Component\Config\Definition\Builder\TreeBuilder; use Symfony\Component\Config\Definition\ConfigurationInterface; @@ -12,9 +13,10 @@ final class Configuration implements ConfigurationInterface public function getConfigTreeBuilder(): TreeBuilder { $treeBuilder = new TreeBuilder('batch_headers'); + $rootNode = $treeBuilder->getRootNode(); + \assert($rootNode instanceof ArrayNodeDefinition); - // @phpstan-ignore-next-line - $treeBuilder->getRootNode() + $rootNode ->children() ->arrayNode('headers') ->arrayPrototype()