@@ -33,14 +33,8 @@ private function parseAtomic(TokenIterator $tokens): Ast\Type\TypeNode
33
33
if ($ tokens ->tryConsumeTokenType (Lexer::TOKEN_OPEN_PARENTHESES )) {
34
34
$ type = $ this ->parse ($ tokens );
35
35
$ tokens ->consumeTokenType (Lexer::TOKEN_CLOSE_PARENTHESES );
36
-
37
- if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_OPEN_SQUARE_BRACKET )) {
38
- $ type = $ this ->tryParseArray ($ tokens , $ type );
39
- }
40
-
41
36
} elseif ($ tokens ->tryConsumeTokenType (Lexer::TOKEN_THIS_VARIABLE )) {
42
- return new Ast \Type \ThisTypeNode ();
43
-
37
+ $ type = new Ast \Type \ThisTypeNode ();
44
38
} else {
45
39
$ type = new Ast \Type \IdentifierTypeNode ($ tokens ->currentTokenValue ());
46
40
$ tokens ->consumeTokenType (Lexer::TOKEN_IDENTIFIER );
@@ -51,14 +45,15 @@ private function parseAtomic(TokenIterator $tokens): Ast\Type\TypeNode
51
45
} elseif ($ tokens ->isCurrentTokenType (Lexer::TOKEN_OPEN_PARENTHESES )) {
52
46
$ type = $ this ->tryParseCallable ($ tokens , $ type );
53
47
54
- } elseif ($ tokens ->isCurrentTokenType (Lexer::TOKEN_OPEN_SQUARE_BRACKET )) {
55
- $ type = $ this ->tryParseArray ($ tokens , $ type );
56
-
57
48
} elseif ($ type ->name === 'array ' && $ tokens ->isCurrentTokenType (Lexer::TOKEN_OPEN_CURLY_BRACKET ) && !$ tokens ->isPrecededByHorizontalWhitespace ()) {
58
49
$ type = $ this ->parseArrayShape ($ tokens , $ type );
59
50
}
60
51
}
61
52
53
+ if ($ tokens ->isCurrentTokenType (Lexer::TOKEN_OPEN_SQUARE_BRACKET )) {
54
+ $ type = $ this ->tryParseArray ($ tokens , $ type );
55
+ }
56
+
62
57
return $ type ;
63
58
}
64
59
0 commit comments