mirror of
https://github.com/danog/phpdoc-parser.git
synced 2024-12-02 09:28:02 +01:00
Add possibility for leading comma
This commit is contained in:
parent
ba7df7e621
commit
9efbbb656a
@ -167,6 +167,7 @@ class TypeParser
|
|||||||
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET);
|
$tokens->consumeTokenType(Lexer::TOKEN_OPEN_ANGLE_BRACKET);
|
||||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||||
$genericTypes = [$this->parse($tokens)];
|
$genericTypes = [$this->parse($tokens)];
|
||||||
|
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||||
|
|
||||||
while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) {
|
while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) {
|
||||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||||
|
@ -3078,6 +3078,54 @@ chunk. Must be higher that in the previous request.'),
|
|||||||
),
|
),
|
||||||
]),
|
]),
|
||||||
];
|
];
|
||||||
|
|
||||||
|
// yield [
|
||||||
|
// 'multiline generic types - trailing comma',
|
||||||
|
// '/**' . PHP_EOL .
|
||||||
|
// ' * @implements Foo<' . PHP_EOL .
|
||||||
|
// ' * A,' . PHP_EOL .
|
||||||
|
// ' * >' . PHP_EOL .
|
||||||
|
// ' */',
|
||||||
|
// new PhpDocNode([
|
||||||
|
// new PhpDocTagNode(
|
||||||
|
// '@implements',
|
||||||
|
// new ImplementsTagValueNode(
|
||||||
|
// new GenericTypeNode(
|
||||||
|
// new IdentifierTypeNode('Foo'),
|
||||||
|
// [
|
||||||
|
// new IdentifierTypeNode('A'),
|
||||||
|
// ]
|
||||||
|
// ),
|
||||||
|
// ''
|
||||||
|
// )
|
||||||
|
// ),
|
||||||
|
// ]),
|
||||||
|
// ];
|
||||||
|
|
||||||
|
yield [
|
||||||
|
'multiline generic types - leading comma',
|
||||||
|
'/**' . PHP_EOL .
|
||||||
|
' * @implements Foo<' . PHP_EOL .
|
||||||
|
' * A' . PHP_EOL .
|
||||||
|
' * , B' . PHP_EOL .
|
||||||
|
' * >' . PHP_EOL .
|
||||||
|
' */',
|
||||||
|
new PhpDocNode([
|
||||||
|
new PhpDocTagNode(
|
||||||
|
'@implements',
|
||||||
|
new ImplementsTagValueNode(
|
||||||
|
new GenericTypeNode(
|
||||||
|
new IdentifierTypeNode('Foo'),
|
||||||
|
[
|
||||||
|
new IdentifierTypeNode('A'),
|
||||||
|
new IdentifierTypeNode('B'),
|
||||||
|
]
|
||||||
|
),
|
||||||
|
''
|
||||||
|
)
|
||||||
|
),
|
||||||
|
]),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
public function dataParseTagValue(): array
|
public function dataParseTagValue(): array
|
||||||
|
Loading…
Reference in New Issue
Block a user