Skip to content

Commit e2c6207

Browse files
authored
Fix build (#287)
1 parent db27c1f commit e2c6207

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"keywords": ["static analysis"],
99
"require": {
1010
"php": "^7.4 || ^8.0",
11-
"phpstan/phpstan": "^2.1.32"
11+
"phpstan/phpstan": "^2.1.41"
1212
},
1313
"conflict": {
1414
"phpunit/phpunit": "<7.0"

src/Rules/PHPUnit/AnnotationHelper.php

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
use PhpParser\Comment\Doc;
66
use PHPStan\Rules\IdentifierRuleError;
77
use PHPStan\Rules\RuleErrorBuilder;
8-
use function array_key_exists;
98
use function in_array;
109
use function preg_match;
1110
use function preg_split;
@@ -43,14 +42,10 @@ public function processDocComment(Doc $docComment): array
4342
foreach ($docCommentLines as $docCommentLine) {
4443
// These annotations can't be retrieved using the getResolvedPhpDoc method on the FileTypeMapper as they are not present when they are invalid
4544
$annotation = preg_match('/(?<annotation>@(?<property>[a-zA-Z]+)(?<whitespace>\s*)(?<value>.*))/', $docCommentLine, $matches);
46-
if ($annotation === false) {
45+
if ($annotation === false || $matches === []) {
4746
continue; // Line without annotation
4847
}
4948

50-
if (array_key_exists('property', $matches) === false || array_key_exists('whitespace', $matches) === false || array_key_exists('annotation', $matches) === false) {
51-
continue;
52-
}
53-
5449
if (!in_array($matches['property'], self::ANNOTATIONS_WITH_PARAMS, true) || $matches['whitespace'] !== '') {
5550
continue;
5651
}

0 commit comments

Comments
 (0)