diff --git a/Stellr/Sniffs/Commenting/ClassCommentSniff.php b/Stellr/Sniffs/Commenting/ClassCommentSniff.php index d645e27..5837a4c 100644 --- a/Stellr/Sniffs/Commenting/ClassCommentSniff.php +++ b/Stellr/Sniffs/Commenting/ClassCommentSniff.php @@ -61,6 +61,11 @@ class ClassCommentSniff implements Sniff '@implements' => false, ]; + private $phpstan_tags = [ + '@phpstan-type' => false, + '@phpstan-import-type' => false, + ]; + /** * Returns an array of tokens this test wants to listen for. * @@ -138,6 +143,7 @@ public function process(File $phpcsFile, $stackPtr) $phpunit_tag_keys = array_keys($this->phpunit_tags); $magic_tag_keys = array_keys($this->magic_tags); $generics_tag_keys = array_keys($this->generics_tags); + $phpstan_tag_keys = array_keys($this->phpstan_tags); $handled = []; @@ -165,6 +171,11 @@ public function process(File $phpcsFile, $stackPtr) $handled[] = $name; continue; } + elseif (in_array($name, $phpstan_tag_keys)) + { + $handled[] = $name; + continue; + } $error = '%s tag is not allowed in class comment'; $data = array($tokens[$tag]['content']);