Skip to content

Fix false-positive undefined variable on static property access#75

Merged
AJenbo merged 1 commit intoAJenbo:mainfrom
lucasacoutinho:fix/static-property-undefined-var
Apr 8, 2026
Merged

Fix false-positive undefined variable on static property access#75
AJenbo merged 1 commit intoAJenbo:mainfrom
lucasacoutinho:fix/static-property-undefined-var

Conversation

@lucasacoutinho
Copy link
Copy Markdown
Contributor

@lucasacoutinho lucasacoutinho commented Apr 8, 2026

Fixing false-positive "undefined variable" warnings that fire on static property access like self::$prop, static::$prop, and ClassName::$prop. The $prop in these cases is a class member name, not a local variable, so the diagnostic shouldn't flag it. The fix distinguishes between the three Variable variants in the scope collector: Direct is a member name and gets skipped, while Indirect (self::$$prop) and Nested (self::${expr}) do reference local variables and are still checked. Both the read and write paths are updated.

@AJenbo AJenbo force-pushed the fix/static-property-undefined-var branch from 93d91f1 to dcc56e1 Compare April 8, 2026 01:25
@AJenbo AJenbo merged commit c0ba452 into AJenbo:main Apr 8, 2026
@AJenbo
Copy link
Copy Markdown
Owner

AJenbo commented Apr 8, 2026

Nice work, thanks.

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