Skip to content

Commit 96c7c66

Browse files
committed
Add tests for template bound + default
1 parent 3c43569 commit 96c7c66

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
@@ -3357,6 +3357,38 @@ public function provideTemplateTagsData(): Iterator
33573357
),
33583358
]),
33593359
];
3360+
3361+
yield [
3362+
'OK with default and description',
3363+
'/** @template T = string the value type */',
3364+
new PhpDocNode([
3365+
new PhpDocTagNode(
3366+
'@template',
3367+
new TemplateTagValueNode(
3368+
'T',
3369+
null,
3370+
'the value type',
3371+
new IdentifierTypeNode('string')
3372+
)
3373+
),
3374+
]),
3375+
];
3376+
3377+
yield [
3378+
'OK with bound and default and description',
3379+
'/** @template T of string = \'\' the value type */',
3380+
new PhpDocNode([
3381+
new PhpDocTagNode(
3382+
'@template',
3383+
new TemplateTagValueNode(
3384+
'T',
3385+
new IdentifierTypeNode('string'),
3386+
'the value type',
3387+
new ConstTypeNode(new ConstExprStringNode(''))
3388+
)
3389+
),
3390+
]),
3391+
];
33603392
}
33613393

33623394
public function provideExtendsTagsData(): Iterator

0 commit comments

Comments
 (0)