Skip to content
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

Handle the ::class static keyword as a special case in parser/variable.js #1138

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

mreiden
Copy link
Contributor

@mreiden mreiden commented Aug 14, 2024

Handle T_Class as a special case when it comes after T_DOUBLE_COLON in recursive_variable_chain_scan

This solves #1135

$arrayVariable[0]::class;
$classVariable->classProp::class

Copy link
Member

@ichiriac ichiriac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The issue comes from the way PHP understands identifier https://github.com/php/php-src/blob/master/Zend/zend_language_parser.y#L325

From a certain version, identifiers are composed also by reserved and semi reserved keywords :
https://github.com/glayzzle/php-parser/blob/main/src/parser/variable.js#L161

Here an example on how it's handled from php 7.0 :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants