Skip to content

Commit 135607f

Browse files
autaut03ondrejmirtes
authored andcommitted
Support @template-contravariant tags
1 parent 25ddf93 commit 135607f

File tree

2 files changed

+18
-0
lines changed

2 files changed

+18
-0
lines changed

Diff for: src/Parser/PhpDocParser.php

+3
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,9 @@ public function parseTagValue(TokenIterator $tokens, string $tag): Ast\PhpDoc\Ph
178178
case '@template-covariant':
179179
case '@phpstan-template-covariant':
180180
case '@psalm-template-covariant':
181+
case '@template-contravariant':
182+
case '@phpstan-template-contravariant':
183+
case '@psalm-template-contravariant':
181184
$tagValue = $this->parseTemplateTagValue($tokens);
182185
break;
183186

Diff for: tests/PHPStan/Parser/PhpDocParserTest.php

+15
Original file line numberDiff line numberDiff line change
@@ -3323,6 +3323,21 @@ public function provideTemplateTagsData(): Iterator
33233323
),
33243324
]),
33253325
];
3326+
3327+
yield [
3328+
'OK with contravariance',
3329+
'/** @template-contravariant T */',
3330+
new PhpDocNode([
3331+
new PhpDocTagNode(
3332+
'@template-contravariant',
3333+
new TemplateTagValueNode(
3334+
'T',
3335+
null,
3336+
''
3337+
)
3338+
),
3339+
]),
3340+
];
33263341
}
33273342

33283343
public function provideExtendsTagsData(): Iterator

0 commit comments

Comments
 (0)