Skip to content

Commit 7d1e812

Browse files
rvanvelzenondrejmirtes
authored andcommitted
Add tests for template bound + default
1 parent ecb475b commit 7d1e812

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

tests/PHPStan/Parser/PhpDocParserTest.php

+32
Original file line numberDiff line numberDiff line change
@@ -3361,6 +3361,38 @@ public function provideTemplateTagsData(): Iterator
33613361
),
33623362
]),
33633363
];
3364+
3365+
yield [
3366+
'OK with default and description',
3367+
'/** @template T = string the value type */',
3368+
new PhpDocNode([
3369+
new PhpDocTagNode(
3370+
'@template',
3371+
new TemplateTagValueNode(
3372+
'T',
3373+
null,
3374+
'the value type',
3375+
new IdentifierTypeNode('string')
3376+
)
3377+
),
3378+
]),
3379+
];
3380+
3381+
yield [
3382+
'OK with bound and default and description',
3383+
'/** @template T of string = \'\' the value type */',
3384+
new PhpDocNode([
3385+
new PhpDocTagNode(
3386+
'@template',
3387+
new TemplateTagValueNode(
3388+
'T',
3389+
new IdentifierTypeNode('string'),
3390+
'the value type',
3391+
new ConstTypeNode(new ConstExprStringNode(''))
3392+
)
3393+
),
3394+
]),
3395+
];
33643396
}
33653397

33663398
public function provideExtendsTagsData(): Iterator

0 commit comments

Comments
 (0)