mirror of
https://github.com/danog/phpdoc-parser.git
synced 2024-11-26 20:15:11 +01:00
commas on next line
This commit is contained in:
parent
e81bfd8679
commit
8a1b0c7090
@ -224,6 +224,7 @@ class TypeParser
|
||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||
$items = [$this->parseArrayShapeItem($tokens)];
|
||||
|
||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||
while ($tokens->tryConsumeTokenType(Lexer::TOKEN_COMMA)) {
|
||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||
if($tokens->tryConsumeTokenType(Lexer::TOKEN_CLOSE_CURLY_BRACKET)) {
|
||||
@ -232,6 +233,7 @@ class TypeParser
|
||||
}
|
||||
|
||||
$items[] = $this->parseArrayShapeItem($tokens);
|
||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||
}
|
||||
|
||||
$tokens->tryConsumeTokenType(Lexer::TOKEN_PHPDOC_EOL);
|
||||
|
@ -507,6 +507,30 @@ class TypeParserTest extends \PHPUnit\Framework\TestCase
|
||||
),
|
||||
]),
|
||||
],
|
||||
[
|
||||
'array{
|
||||
a: int
|
||||
, b: string
|
||||
, c: string
|
||||
}',
|
||||
new ArrayShapeNode([
|
||||
new ArrayShapeItemNode(
|
||||
new IdentifierTypeNode('a'),
|
||||
false,
|
||||
new IdentifierTypeNode('int')
|
||||
),
|
||||
new ArrayShapeItemNode(
|
||||
new IdentifierTypeNode('b'),
|
||||
false,
|
||||
new IdentifierTypeNode('string')
|
||||
),
|
||||
new ArrayShapeItemNode(
|
||||
new IdentifierTypeNode('c'),
|
||||
false,
|
||||
new IdentifierTypeNode('string')
|
||||
),
|
||||
]),
|
||||
],
|
||||
[
|
||||
'array{
|
||||
a: int,
|
||||
|
Loading…
Reference in New Issue
Block a user