@@ -5145,16 +5145,89 @@ public function provideTypeAliasTagsData(): Iterator
51455145 Lexer::TOKEN_CLOSE_PHPDOC ,
51465146 18 ,
51475147 Lexer::TOKEN_IDENTIFIER ,
5148- null ,
5149- 1 ,
5150- ),
5148+ null ,
5149+ 1 ,
51515150 ),
51525151 ),
5153- ]),
5154- ];
5155- }
5152+ ),
5153+ ]),
5154+ ];
5155+
5156+ yield [
5157+ 'OK with one template type ' ,
5158+ '/** @phpstan-type Wrapper<T> T */ ' ,
5159+ new PhpDocNode ([
5160+ new PhpDocTagNode (
5161+ '@phpstan-type ' ,
5162+ new TypeAliasTagValueNode (
5163+ 'Wrapper ' ,
5164+ new IdentifierTypeNode ('T ' ),
5165+ [
5166+ new TemplateTagValueNode ('T ' , null , '' ),
5167+ ],
5168+ ),
5169+ ),
5170+ ]),
5171+ ];
5172+
5173+ yield [
5174+ 'OK with two template types ' ,
5175+ '/** @phpstan-type Pair<TFirst, TSecond> TFirst */ ' ,
5176+ new PhpDocNode ([
5177+ new PhpDocTagNode (
5178+ '@phpstan-type ' ,
5179+ new TypeAliasTagValueNode (
5180+ 'Pair ' ,
5181+ new IdentifierTypeNode ('TFirst ' ),
5182+ [
5183+ new TemplateTagValueNode ('TFirst ' , null , '' ),
5184+ new TemplateTagValueNode ('TSecond ' , null , '' ),
5185+ ],
5186+ ),
5187+ ),
5188+ ]),
5189+ ];
5190+
5191+ yield [
5192+ 'OK with bounded template type ' ,
5193+ '/** @phpstan-type Collection<T of object> list<T> */ ' ,
5194+ new PhpDocNode ([
5195+ new PhpDocTagNode (
5196+ '@phpstan-type ' ,
5197+ new TypeAliasTagValueNode (
5198+ 'Collection ' ,
5199+ new GenericTypeNode (
5200+ new IdentifierTypeNode ('list ' ),
5201+ [new IdentifierTypeNode ('T ' )],
5202+ [GenericTypeNode::VARIANCE_INVARIANT ],
5203+ ),
5204+ [
5205+ new TemplateTagValueNode ('T ' , new IdentifierTypeNode ('object ' ), '' ),
5206+ ],
5207+ ),
5208+ ),
5209+ ]),
5210+ ];
5211+
5212+ yield [
5213+ 'OK with default template type ' ,
5214+ '/** @phpstan-type WithDefault<T = string> T */ ' ,
5215+ new PhpDocNode ([
5216+ new PhpDocTagNode (
5217+ '@phpstan-type ' ,
5218+ new TypeAliasTagValueNode (
5219+ 'WithDefault ' ,
5220+ new IdentifierTypeNode ('T ' ),
5221+ [
5222+ new TemplateTagValueNode ('T ' , null , '' , new IdentifierTypeNode ('string ' )),
5223+ ],
5224+ ),
5225+ ),
5226+ ]),
5227+ ];
5228+ }
51565229
5157- public function provideTypeAliasImportTagsData (): Iterator
5230+ public function provideTypeAliasImportTagsData (): Iterator
51585231 {
51595232 yield [
51605233 'OK ' ,
0 commit comments