diff --git a/src/Parser/PhpDocParser.php b/src/Parser/PhpDocParser.php index e6d79b3d..4444a12b 100644 --- a/src/Parser/PhpDocParser.php +++ b/src/Parser/PhpDocParser.php @@ -161,6 +161,9 @@ public function parseTagValue(TokenIterator $tokens, string $tag): Ast\PhpDoc\Ph case '@template': case '@phpstan-template': case '@psalm-template': + case '@template-covariant': + case '@phpstan-template-covariant': + case '@psalm-template-covariant': $tagValue = $this->parseTemplateTagValue($tokens); break; diff --git a/tests/PHPStan/Parser/PhpDocParserTest.php b/tests/PHPStan/Parser/PhpDocParserTest.php index ee37f6ac..f4a9fc0f 100644 --- a/tests/PHPStan/Parser/PhpDocParserTest.php +++ b/tests/PHPStan/Parser/PhpDocParserTest.php @@ -2371,6 +2371,21 @@ public function provideTemplateTagsData(): \Iterator ), ]), ]; + + yield [ + 'OK with covariance', + '/** @template-covariant T */', + new PhpDocNode([ + new PhpDocTagNode( + '@template-covariant', + new TemplateTagValueNode( + 'T', + null, + '' + ) + ), + ]), + ]; } public function provideExtendsTagsData(): \Iterator