-
Notifications
You must be signed in to change notification settings - Fork 570
Expand file tree
/
Copy pathPhpDocParser.patch
More file actions
39 lines (36 loc) · 1.23 KB
/
PhpDocParser.patch
File metadata and controls
39 lines (36 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
--- src/Parser/PhpDocParser.php
+++ src/Parser/PhpDocParser.php
@@ -1067,6 +1067,21 @@
$alias = $tokens->currentTokenValue();
$tokens->consumeTokenType(Lexer::TOKEN_IDENTIFIER);
+ $templateTypes = [];
+ if ($tokens->tryConsumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET)) {
+ do {
+ $startLine = $tokens->currentTokenLine();
+ $startIndex = $tokens->currentTokenIndex();
+ $templateTypes[] = $this->enrichWithAttributes(
+ $tokens,
+ $this->typeParser->parseTemplateTagValue($tokens),
+ $startLine,
+ $startIndex,
+ );
+ } while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA));
+ $tokens->consumeTokenType(Lexer::TOKEN_CLOSE_ANGLE_BRACKET);
+ }
+
// support phan-type/psalm-type syntax
$tokens->tryConsumeTokenType(Lexer::TOKEN_EQUAL);
@@ -1087,12 +1102,13 @@
}
}
- return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $type);
+ return new Ast\PhpDoc\TypeAliasTagValueNode($alias, $type, $templateTypes);
} catch (ParserException $e) {
$this->parseOptionalDescription($tokens, false);
return new Ast\PhpDoc\TypeAliasTagValueNode(
$alias,
$this->enrichWithAttributes($tokens, new Ast\Type\InvalidTypeNode($e), $startLine, $startIndex),
+ $templateTypes,
);
}
}