You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
test/node_modules/php-parser/src/parser.js:357
throw err;
^
SyntaxError: Parse Error : syntax error, unexpected '?->' (T_NULLSAFE_OBJECT_OPERATOR), expecting ';' on line 1
at Parser.raiseError (test/node_modules/php-parser/src/parser.js:349:17)
at Parser.error (test/node_modules/php-parser/src/parser.js:397:15)
at Parser.expectEndOfStatement (test/node_modules/php-parser/src/parser.js:508:10)
at Parser.read_statement (test/node_modules/php-parser/src/parser/statement.js:279:14)
at Parser.read_top_statement (test/node_modules/php-parser/src/parser/statement.js:78:21)
at Parser.read_start (test/node_modules/php-parser/src/parser/main.js:18:19)
at Parser.parse (test/node_modules/php-parser/src/parser.js:301:22)
at Engine.parseEval (test/node_modules/php-parser/src/index.js:146:22)
at Object.<anonymous> (test/test.js:3:21)
at Module._compile (node:internal/modules/cjs/loader:1546:14) {
lineNumber: 1,
fileName: 'eval',
columnNumber: 20
}
Node.js v22.7.0
The text was updated successfully, but these errors were encountered:
Good day, first thanks for the awesome project!
I noticed the parser fails if you have something between parenthesis before a nullsafe operator. I found it when using code like
echo ($published_at ?? $last_modified_at)?->format('M d, Y');
but it fails even with
($published_at)?->format('M d, Y');
Here's a small example:
And here's the output:
The text was updated successfully, but these errors were encountered: