From 7d766aed25b9a0fac74b7f4c788158e810dd0c11 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 12 Mar 2026 14:07:27 +0100 Subject: [PATCH 1/4] Fix build --- composer.json | 2 +- src/Rules/PHPUnit/AnnotationHelper.php | 6 +----- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/composer.json b/composer.json index 08cd088a..f842bb44 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "keywords": ["static analysis"], "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.1.32" + "phpstan/phpstan": "^2.1.41" }, "conflict": { "phpunit/phpunit": "<7.0" diff --git a/src/Rules/PHPUnit/AnnotationHelper.php b/src/Rules/PHPUnit/AnnotationHelper.php index 21623cab..1db5618b 100644 --- a/src/Rules/PHPUnit/AnnotationHelper.php +++ b/src/Rules/PHPUnit/AnnotationHelper.php @@ -43,14 +43,10 @@ public function processDocComment(Doc $docComment): array foreach ($docCommentLines as $docCommentLine) { // These annotations can't be retrieved using the getResolvedPhpDoc method on the FileTypeMapper as they are not present when they are invalid $annotation = preg_match('/(?@(?[a-zA-Z]+)(?\s*)(?.*))/', $docCommentLine, $matches); - if ($annotation === false) { + if ($annotation === false || $matches === []) { continue; // Line without annotation } - if (array_key_exists('property', $matches) === false || array_key_exists('whitespace', $matches) === false || array_key_exists('annotation', $matches) === false) { - continue; - } - if (!in_array($matches['property'], self::ANNOTATIONS_WITH_PARAMS, true) || $matches['whitespace'] !== '') { continue; } From c5e6df3a1688ac29474927dd8e53da1b37c1efb0 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 12 Mar 2026 14:08:00 +0100 Subject: [PATCH 2/4] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f842bb44..08cd088a 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "keywords": ["static analysis"], "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.1.41" + "phpstan/phpstan": "^2.1.32" }, "conflict": { "phpunit/phpunit": "<7.0" From 3e70ae9537c5885f14ca8541669b0b8900003c93 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 12 Mar 2026 14:08:44 +0100 Subject: [PATCH 3/4] Update composer.json --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 08cd088a..f842bb44 100644 --- a/composer.json +++ b/composer.json @@ -8,7 +8,7 @@ "keywords": ["static analysis"], "require": { "php": "^7.4 || ^8.0", - "phpstan/phpstan": "^2.1.32" + "phpstan/phpstan": "^2.1.41" }, "conflict": { "phpunit/phpunit": "<7.0" From 0ac8914fb876ce7ca6960fb19044c10eda945935 Mon Sep 17 00:00:00 2001 From: Markus Staab Date: Thu, 12 Mar 2026 14:10:54 +0100 Subject: [PATCH 4/4] cs --- src/Rules/PHPUnit/AnnotationHelper.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Rules/PHPUnit/AnnotationHelper.php b/src/Rules/PHPUnit/AnnotationHelper.php index 1db5618b..dc89bdb7 100644 --- a/src/Rules/PHPUnit/AnnotationHelper.php +++ b/src/Rules/PHPUnit/AnnotationHelper.php @@ -5,7 +5,6 @@ use PhpParser\Comment\Doc; use PHPStan\Rules\IdentifierRuleError; use PHPStan\Rules\RuleErrorBuilder; -use function array_key_exists; use function in_array; use function preg_match; use function preg_split;