Skip to content

Commit dc5a270

Browse files
committed
RequireExplicitAssertionSniff: Fixed internal error
1 parent 8f7a1de commit dc5a270

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

SlevomatCodingStandard/Sniffs/PHP/RequireExplicitAssertionSniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ public function process(File $phpcsFile, $docCommentOpenPointer): void
7878

7979
/** @var \SlevomatCodingStandard\Helpers\Annotation\VariableAnnotation $variableAnnotation */
8080
foreach (array_reverse($variableAnnotations) as $variableAnnotation) {
81+
if ($variableAnnotation->isInvalid()) {
82+
continue;
83+
}
84+
8185
if ($variableAnnotation->getVariableName() === null) {
8286
continue;
8387
}

tests/Sniffs/PHP/data/requireExplicitAssertionNoErrors.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,6 @@ function (int $a) {
4848

4949
/** @var bool $l */
5050
[$l];
51+
52+
/** @var $m invalid annotation */
53+
$m = 0;

0 commit comments

Comments
 (0)