@@ -196,28 +196,45 @@ private function parseAtomic(TokenIterator $tokens): Ast\Type\TypeNode
196
196
$ tokens ->dropSavePoint (); // because of ConstFetchNode
197
197
}
198
198
199
- $ exception = new ParserException (
200
- $ tokens ->currentTokenValue (),
201
- $ tokens ->currentTokenType (),
202
- $ tokens ->currentTokenOffset (),
203
- Lexer::TOKEN_IDENTIFIER ,
204
- null ,
205
- $ tokens ->currentTokenLine ()
206
- );
199
+ $ currentTokenValue = $ tokens ->currentTokenValue ();
200
+ $ currentTokenType = $ tokens ->currentTokenType ();
201
+ $ currentTokenOffset = $ tokens ->currentTokenOffset ();
202
+ $ currentTokenLine = $ tokens ->currentTokenLine ();
207
203
208
204
if ($ this ->constExprParser === null ) {
209
- throw $ exception ;
205
+ throw new ParserException (
206
+ $ currentTokenValue ,
207
+ $ currentTokenType ,
208
+ $ currentTokenOffset ,
209
+ Lexer::TOKEN_IDENTIFIER ,
210
+ null ,
211
+ $ currentTokenLine
212
+ );
210
213
}
211
214
212
215
try {
213
216
$ constExpr = $ this ->constExprParser ->parse ($ tokens , true );
214
217
if ($ constExpr instanceof Ast \ConstExpr \ConstExprArrayNode) {
215
- throw $ exception ;
218
+ throw new ParserException (
219
+ $ currentTokenValue ,
220
+ $ currentTokenType ,
221
+ $ currentTokenOffset ,
222
+ Lexer::TOKEN_IDENTIFIER ,
223
+ null ,
224
+ $ currentTokenLine
225
+ );
216
226
}
217
227
218
228
return $ this ->enrichWithAttributes ($ tokens , new Ast \Type \ConstTypeNode ($ constExpr ), $ startLine , $ startIndex );
219
229
} catch (LogicException $ e ) {
220
- throw $ exception ;
230
+ throw new ParserException (
231
+ $ currentTokenValue ,
232
+ $ currentTokenType ,
233
+ $ currentTokenOffset ,
234
+ Lexer::TOKEN_IDENTIFIER ,
235
+ null ,
236
+ $ currentTokenLine
237
+ );
221
238
}
222
239
}
223
240
0 commit comments