From 4543647b2251dfe0e355b8a05f04bc165dbfb5d2 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 22 Oct 2026 18:51:51 +0200 Subject: [PATCH 1/3] #83 - PHPStan: deprecation rules and PHPUnit extensions Co-Authored-By: Claude Opus 5.5 (1M context) --- composer.json | 2 ++ 1 file changed, 2 insertions(+) diff --git a/composer.json b/composer.json index d39fa4b..e7ad3a6 100644 --- a/composer.json +++ b/composer.json @@ -65,6 +65,8 @@ "friendsofphp/php-cs-fixer": "*", "phpstan/extension-installer": "*", "phpstan/phpstan": "*", + "phpstan/phpstan-deprecation-rules": "*", + "phpstan/phpstan-phpunit": "*", "phpstan/phpstan-doctrine": "*", "phpstan/phpstan-symfony": "*", "phpunit/phpunit": "^10.5|^11|^12|^13", From 70e6742cf395e40691605755602e154719bda732 Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 22 Oct 2026 22:03:40 +0200 Subject: [PATCH 2/3] #83 - PHPStan: ignore the deprecations kept on purpose (PHPUnit 13 expectExceptionMessage(), Symfony 8.1 BundleInterface, tests of the deprecated code, BC code) and the regression assertions Co-Authored-By: Claude Opus 5.5 (1M context) --- phpstan.neon | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/phpstan.neon b/phpstan.neon index e9a9e7e..40496eb 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,3 +3,16 @@ parameters: paths: - src - tests + ignoreErrors: + # PHPUnit 13 deprecates expectExceptionMessage() (sebastianbergmann/phpunit#6560), still needed with PHPUnit 11 and 12 + - message: '#^Call to deprecated method expectExceptionMessage\(\) of class PHPUnit\\Framework\\TestCase#' + path: tests/* + # Symfony 8.1 deprecates HttpKernel\Bundle\BundleInterface: its replacement does not exist in Symfony 6.4 and 7.4 + - message: '#typehint with deprecated interface Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface#' + path: tests/* + # Assertions on values already known by PHPStan, kept as regression checks + - identifier: staticMethod.alreadyNarrowedType + path: tests/* + # Values changed by reference in a closure: unknown to PHPStan + - identifier: staticMethod.impossibleType + path: tests/* From 70e2c2761d58ec2e1ad9af28bd58a3864c6ff75f Mon Sep 17 00:00:00 2001 From: Nicolas Joubert Date: Thu, 22 Oct 2026 22:29:29 +0200 Subject: [PATCH 3/3] #83 - PHPStan: same ignores in all the bundles (method and static method assertions, unmatched ignores not reported) Co-Authored-By: Claude Opus 5.5 (1M context) --- phpstan.neon | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index 40496eb..906f411 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -3,6 +3,8 @@ parameters: paths: - src - tests + # Same ignores in all the process bundles: not all of them match in each bundle + reportUnmatchedIgnoredErrors: false ignoreErrors: # PHPUnit 13 deprecates expectExceptionMessage() (sebastianbergmann/phpunit#6560), still needed with PHPUnit 11 and 12 - message: '#^Call to deprecated method expectExceptionMessage\(\) of class PHPUnit\\Framework\\TestCase#' @@ -10,9 +12,15 @@ parameters: # Symfony 8.1 deprecates HttpKernel\Bundle\BundleInterface: its replacement does not exist in Symfony 6.4 and 7.4 - message: '#typehint with deprecated interface Symfony\\Component\\HttpKernel\\Bundle\\BundleInterface#' path: tests/* - # Assertions on values already known by PHPStan, kept as regression checks + # The tests of the deprecated code of the bundles use it + - message: '#deprecated .*CleverAge\\#' + path: tests/* + # Assertions on values already known by PHPStan, kept as regression checks (or values changed by reference) - identifier: staticMethod.alreadyNarrowedType path: tests/* - # Values changed by reference in a closure: unknown to PHPStan + - identifier: method.alreadyNarrowedType + path: tests/* - identifier: staticMethod.impossibleType path: tests/* + - identifier: method.impossibleType + path: tests/*