Skip to content

Commit 165c96a

Browse files
committed
TypeHintDeclarationSniff: Invalid annotations should be ignored
1 parent 362b312 commit 165c96a

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

SlevomatCodingStandard/Sniffs/TypeHints/TypeHintDeclarationSniff.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -736,6 +736,10 @@ private function checkPropertyTypeHint(File $phpcsFile, int $propertyPointer): v
736736
return;
737737
}
738738

739+
if ($varAnnotations[0]->isInvalid()) {
740+
return;
741+
}
742+
739743
$propertyTypeNode = $varAnnotations[0]->getType();
740744

741745
if (

tests/Sniffs/TypeHints/data/typeHintDeclarationNoErrors.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -692,6 +692,11 @@ public function returnsArrayOrString()
692692
return [];
693693
}
694694

695+
/**
696+
* @var string|
697+
*/
698+
private $invalidAnnotation;
699+
695700
}
696701

697702
class IntersectionAndGeneric

0 commit comments

Comments
 (0)