File tree 2 files changed +17
-0
lines changed
2 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -111,6 +111,12 @@ private function parseAtomic(TokenIterator $tokens): Ast\Type\TypeNode
111
111
if ($ constExpr instanceof Ast \ConstExpr \ConstExprArrayNode) {
112
112
throw $ exception ;
113
113
}
114
+ if ($ constExpr instanceof Ast \ConstExpr \ConstFetchNode) {
115
+ if ($ tokens ->currentTokenValue () === '* ' ) {
116
+ $ tokens ->consumeTokenType ($ tokens ->currentTokenType ());
117
+ $ constExpr = new Ast \ConstExpr \ConstFetchNode ($ constExpr ->className , $ constExpr ->name . '* ' );
118
+ }
119
+ }
114
120
return new Ast \Type \ConstTypeNode ($ constExpr );
115
121
} catch (\LogicException $ e ) {
116
122
throw $ exception ;
Original file line number Diff line number Diff line change @@ -854,6 +854,17 @@ public function provideParseData(): array
854
854
'"bar" ' ,
855
855
new ConstTypeNode (new ConstExprStringNode ('bar ' )),
856
856
],
857
+ [
858
+ 'Foo::FOO_* ' ,
859
+ new ConstTypeNode (new ConstFetchNode ('Foo ' , 'FOO_* ' )),
860
+ ],
861
+ [
862
+ '( "foo" | Foo::FOO_* ) ' ,
863
+ new UnionTypeNode ([
864
+ new ConstTypeNode (new ConstExprStringNode ('foo ' )),
865
+ new ConstTypeNode (new ConstFetchNode ('Foo ' , 'FOO_* ' )),
866
+ ]),
867
+ ],
857
868
];
858
869
}
859
870
You can’t perform that action at this time.
0 commit comments