From 970efbe67465040ad151bcad420931df71a5b266 Mon Sep 17 00:00:00 2001 From: othillo Date: Fri, 7 Aug 2026 21:02:29 +0200 Subject: [PATCH 1/3] ci: run on ubuntu-latest, update actions and PHP matrix --- .github/workflows/ci.yml | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 08f9fde..73620a7 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,25 +13,20 @@ on: jobs: tests: name: "Run tests" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" strategy: fail-fast: false matrix: php-version: # https://www.php.net/supported-versions.php - - "8.1" - - "8.2" - "8.3" + - "8.4" + - "8.5" symfony-version: # https://symfony.com/releases - - "5.4" - "6.4" - - "7.0" - exclude: - # Symfony 7 requires PHP 8.2+ - - php-version: '8.1' - symfony-version: '7.0' + - "7.4" steps: - name: "Checkout" - uses: "actions/checkout@v4" + uses: "actions/checkout@v7" - name: "Install PHP" uses: "shivammathur/setup-php@v2" with: @@ -42,7 +37,7 @@ jobs: - name: "Validate composer.json and composer.lock" run: "composer validate --strict --no-interaction --ansi" - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v3" + uses: "ramsey/composer-install@v4" - name: "Install specific Symfony version" run: "composer require --no-interaction symfony/console:^${{ matrix.symfony-version }} symfony/http-kernel:^${{ matrix.symfony-version }} symfony/framework-bundle:^${{ matrix.symfony-version }} symfony/yaml:^${{ matrix.symfony-version }} -W" - name: "Run tests" @@ -54,17 +49,17 @@ jobs: static-analysis: name: "Static analysis" - runs-on: "ubuntu-20.04" + runs-on: "ubuntu-latest" continue-on-error: true steps: - name: "Checkout" - uses: "actions/checkout@v4" + uses: "actions/checkout@v7" - name: "Install PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.0" + php-version: "8.4" coverage: "none" - name: "Install dependencies with Composer" - uses: "ramsey/composer-install@v3" + uses: "ramsey/composer-install@v4" - name: "Run PHPStan" run: "make phpstan" From 93108497b6bebbe7b28a695699beb2946aab3a9b Mon Sep 17 00:00:00 2001 From: othillo Date: Fri, 7 Aug 2026 21:17:27 +0200 Subject: [PATCH 2/3] ci: upgrade PHPStan to 2.x --- composer.json | 4 +- phpstan-baseline.neon | 115 ++++++++++++++++++++++++++++++++++++++++++ phpstan.neon | 10 ++-- 3 files changed, 122 insertions(+), 7 deletions(-) create mode 100644 phpstan-baseline.neon diff --git a/composer.json b/composer.json index a08285d..08eab17 100644 --- a/composer.json +++ b/composer.json @@ -46,11 +46,11 @@ "matthiasnoback/symfony-config-test": "^4.0 || ^5.0", "matthiasnoback/symfony-dependency-injection-test": "^4.0 || ^5.0", "monolog/monolog": "~2.0", - "phpstan/phpstan": "@stable", + "phpstan/phpstan": "^2.0", "phpunit/phpunit": "^9.5", "symfony/framework-bundle": "^4.4 || ^5.3 || ^6.0 || ^7.0", "symfony/proxy-manager-bridge": "^4.4 || ^5.3 || ^6.0", - "phpstan/phpstan-symfony": "^1.0", + "phpstan/phpstan-symfony": "^2.0", "friendsofphp/php-cs-fixer": "^3.0" }, "suggest": { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..23e2d99 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,115 @@ +parameters: + ignoreErrors: + - + message: '#^Call to function method_exists\(\) with Symfony\\Component\\Console\\Input\\InputInterface and ''__toString'' will always evaluate to true\.$#' + identifier: function.alreadyNarrowedType + count: 1 + path: src/Command/CommandMetadataEnricher.php + + - + message: '#^Cannot access offset ''enabled'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/DependencyInjection/BroadwayExtension.php + + - + message: '#^Cannot access offset ''state_repository'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/DependencyInjection/BroadwayExtension.php + + - + message: '#^Method Broadway\\Bundle\\BroadwayBundle\\DependencyInjection\\BroadwayExtension\:\:loadCommandBus\(\) has parameter \$config with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/DependencyInjection/BroadwayExtension.php + + - + message: '#^Method Broadway\\Bundle\\BroadwayBundle\\DependencyInjection\\BroadwayExtension\:\:loadInternal\(\) has parameter \$mergedConfig with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/DependencyInjection/BroadwayExtension.php + + - + message: '#^Method Broadway\\Bundle\\BroadwayBundle\\DependencyInjection\\BroadwayExtension\:\:loadSerializers\(\) has parameter \$config with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: src/DependencyInjection/BroadwayExtension.php + + - + message: '#^Parameter \#1 \$config of method Broadway\\Bundle\\BroadwayBundle\\DependencyInjection\\BroadwayExtension\:\:loadCommandBus\(\) expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/DependencyInjection/BroadwayExtension.php + + - + message: '#^Parameter \#1 \$config of method Broadway\\Bundle\\BroadwayBundle\\DependencyInjection\\BroadwayExtension\:\:loadSerializers\(\) expects array, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/DependencyInjection/BroadwayExtension.php + + - + message: '#^Parameter \#1 \$id of class Symfony\\Component\\DependencyInjection\\Alias constructor expects string, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/DependencyInjection/BroadwayExtension.php + + - + message: '#^Parameter \#2 \$value of method Symfony\\Component\\DependencyInjection\\Container\:\:setParameter\(\) expects array\|bool\|float\|int\|string\|UnitEnum\|null, mixed given\.$#' + identifier: argument.type + count: 4 + path: src/DependencyInjection/BroadwayExtension.php + + - + message: '#^Parameter \#1 \$objectOrClass of class ReflectionClass constructor expects class\-string\\|T of object, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/DependencyInjection/CompilerPass.php + + - + message: '#^Parameter \#2 \.\.\.\$values of function sprintf expects bool\|float\|int\|string\|null, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/DependencyInjection/CompilerPass.php + + - + message: '#^Parameter \#1 \$objectOrClass of class ReflectionClass constructor expects class\-string\\|T of object, mixed given\.$#' + identifier: argument.type + count: 1 + path: src/DependencyInjection/RegisterBusSubscribersCompilerPass.php + + - + message: '#^Cannot access offset ''event'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/DependencyInjection/RegisterEventListenerCompilerPass.php + + - + message: '#^Cannot access offset ''method'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/DependencyInjection/RegisterEventListenerCompilerPass.php + + - + message: '#^Cannot access offset ''type'' on mixed\.$#' + identifier: offsetAccess.nonOffsetAccessible + count: 1 + path: src/DependencyInjection/RegisterSagaCompilerPass.php + + - + message: '#^Possibly invalid array key type mixed\.$#' + identifier: offsetAccess.invalidOffset + count: 1 + path: src/DependencyInjection/RegisterSagaCompilerPass.php + + - + message: '#^Method Broadway\\Bundle\\BroadwayBundle\\AppKernel\:\:registerBundles\(\) return type has no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: test/AppKernel.php + + - + message: '#^Method Broadway\\Bundle\\BroadwayBundle\\BroadwayBundleTest\:\:createKernel\(\) has parameter \$options with no value type specified in iterable type array\.$#' + identifier: missingType.iterableValue + count: 1 + path: test/BroadwayBundleTest.php diff --git a/phpstan.neon b/phpstan.neon index 46aef57..e785073 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,12 +1,12 @@ includes: + - phpstan-baseline.neon - vendor/phpstan/phpstan-symfony/extension.neon parameters: paths: - . excludePaths: - - Tests/ - - vendor/ - - var/ - - Resources/doc/example/ - checkMissingIterableValueType: false + - Tests/ (?) + - vendor/ (?) + - var/ (?) + - Resources/doc/example/ (?) inferPrivatePropertyTypeFromConstructor: true From 6cffc1764f03604ac502559a9e49b54f0cfdd1ee Mon Sep 17 00:00:00 2001 From: othillo Date: Fri, 7 Aug 2026 21:26:38 +0200 Subject: [PATCH 3/3] ci: test every supported PHP version --- .github/workflows/ci.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 73620a7..091a211 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,6 +18,10 @@ jobs: fail-fast: false matrix: php-version: # https://www.php.net/supported-versions.php + - "8.3" + - "8.4" + - "8.2" + - "8.2" - "8.3" - "8.4" - "8.5" @@ -57,7 +61,7 @@ jobs: - name: "Install PHP" uses: "shivammathur/setup-php@v2" with: - php-version: "8.4" + php-version: "8.5" coverage: "none" - name: "Install dependencies with Composer" uses: "ramsey/composer-install@v4"