File tree 2 files changed +31
-1
lines changed
2 files changed +31
-1
lines changed Original file line number Diff line number Diff line change @@ -320,7 +320,7 @@ private function parseTemplateTagValue(TokenIterator $tokens): Ast\PhpDoc\Templa
320
320
$ name = $ tokens ->currentTokenValue ();
321
321
$ tokens ->consumeTokenType (Lexer::TOKEN_IDENTIFIER );
322
322
323
- if ($ tokens ->tryConsumeTokenValue ('of ' )) {
323
+ if ($ tokens ->tryConsumeTokenValue ('of ' ) || $ tokens -> tryConsumeTokenValue ( ' as ' ) ) {
324
324
$ bound = $ this ->typeParser ->parse ($ tokens );
325
325
326
326
} else {
Original file line number Diff line number Diff line change @@ -2319,6 +2319,21 @@ public function provideTemplateTagsData(): \Iterator
2319
2319
]),
2320
2320
];
2321
2321
2322
+ yield [
2323
+ 'OK without description ' ,
2324
+ '/** @template T as DateTime */ ' ,
2325
+ new PhpDocNode ([
2326
+ new PhpDocTagNode (
2327
+ '@template ' ,
2328
+ new TemplateTagValueNode (
2329
+ 'T ' ,
2330
+ new IdentifierTypeNode ('DateTime ' ),
2331
+ ''
2332
+ )
2333
+ ),
2334
+ ]),
2335
+ ];
2336
+
2322
2337
yield [
2323
2338
'OK with bound and description ' ,
2324
2339
'/** @template T of DateTime the value type */ ' ,
@@ -2334,6 +2349,21 @@ public function provideTemplateTagsData(): \Iterator
2334
2349
]),
2335
2350
];
2336
2351
2352
+ yield [
2353
+ 'OK with bound and description ' ,
2354
+ '/** @template T as DateTime the value type */ ' ,
2355
+ new PhpDocNode ([
2356
+ new PhpDocTagNode (
2357
+ '@template ' ,
2358
+ new TemplateTagValueNode (
2359
+ 'T ' ,
2360
+ new IdentifierTypeNode ('DateTime ' ),
2361
+ 'the value type '
2362
+ )
2363
+ ),
2364
+ ]),
2365
+ ];
2366
+
2337
2367
yield [
2338
2368
'invalid without bound and description ' ,
2339
2369
'/** @template */ ' ,
You can’t perform that action at this time.
0 commit comments