-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Property with multiple props and property hooks should be a parse error #1050
Comments
I'm fine with having this as a parse error. |
Thanks. Unfortunately I don't know how to implement this one, grammar is still out of my expertise. |
This one wouldn't be checked directly in the grammar, it needs a manual check like the one here: PHP-Parser/lib/PhpParser/ParserAbstract.php Lines 1161 to 1167 in 4f9dc8b
|
Alright, tried it: #1052 Had to modify the grammar anyway 😅 |
This piece of code:
Is rejected by PHP with error message:
Parse error: syntax error, unexpected token “{”, expecting “,” or “;” in /in/RndUG on line 6
But PHP-Parser does not report syntax error and represents this with an AST.
Multi-props with property hooks are not supported in PHP. I'm asking about this to find out if this should be a parse error in PHP-Parser, or if this is going to be represented with an AST and PHPStan should come with a custom rule to detect it.
Thanks.
The text was updated successfully, but these errors were encountered: