diff --git a/src/Parser/PhpDocParser.php b/src/Parser/PhpDocParser.php index 2302232..ee7848c 100644 --- a/src/Parser/PhpDocParser.php +++ b/src/Parser/PhpDocParser.php @@ -178,6 +178,9 @@ class PhpDocParser case '@template-covariant': case '@phpstan-template-covariant': case '@psalm-template-covariant': + case '@template-contravariant': + case '@phpstan-template-contravariant': + case '@psalm-template-contravariant': $tagValue = $this->parseTemplateTagValue($tokens); break; diff --git a/tests/PHPStan/Parser/PhpDocParserTest.php b/tests/PHPStan/Parser/PhpDocParserTest.php index 28b0a8e..ccf7165 100644 --- a/tests/PHPStan/Parser/PhpDocParserTest.php +++ b/tests/PHPStan/Parser/PhpDocParserTest.php @@ -3323,6 +3323,21 @@ some text in the middle' ), ]), ]; + + yield [ + 'OK with contravariance', + '/** @template-contravariant T */', + new PhpDocNode([ + new PhpDocTagNode( + '@template-contravariant', + new TemplateTagValueNode( + 'T', + null, + '' + ) + ), + ]), + ]; } public function provideExtendsTagsData(): Iterator