Closed
Description
It looks like files that have typed constants are not parseable by the latest version (3.1.5).
Input file:
<?php
class Test {
private const int MY_CONST = 3;
}
Error:
SyntaxError: Parse Error : syntax error, unexpected 'MY_CONST' (T_STRING), expecting '=' on line 4
at Parser.raiseError (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser.js:349:17)
at Parser.error (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser.js:397:15)
at Parser.expect (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser.js:577:10)
at Parser.read_constant_declaration (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser/class.js:261:18)
at Parser.read_list (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser/utils.js:76:33)
at Parser.read_constant_list (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser/class.js:237:24)
at Parser.read_class_body (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser/class.js:117:32)
at Parser.read_class_declaration_statement (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser/class.js:32:30)
at Parser.read_top_statement (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser/statement.js:52:21)
at Parser.read_start (/home/user/Code/node_modules/.pnpm/[email protected]/node_modules/php-parser/src/parser/main.js:18:19) {
lineNumber: 4,
fileName: 'eval',
columnNumber: 21
}
Metadata
Metadata
Assignees
Labels
No labels