Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[FIX] dynamic variable undefined inside isset #4213

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

Open
ga-devfront wants to merge 10 commits into phpstan:2.1.x
base: 2.1.x
Choose a base branch
Loading
from ga-devfront:fix/variable-undefined

Conversation

Copy link

@ga-devfront ga-devfront commented Aug 7, 2025

Fix phpstan/phpstan#13353
This is the fix for the issue above. If you see any changes to make, please let me know; this is my first contribution to the project.

Jellyfrog reacted with thumbs up emoji
Copy link
Member

@ondrejmirtes ondrejmirtes left a comment

Choose a reason for hiding this comment

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

Please look at this problem more thoroughly. There's IssetCheck (

if ($expr instanceof Node\Expr\Variable && is_string($expr->name)) {
) used by several rules where only Variable with string name property is being handled, but the code might find some improvements to the logic useful.

Copy link
Author

Please look at this problem more thoroughly. There's IssetCheck (

if ($expr instanceof Node\Expr\Variable && is_string($expr->name)) {

) used by several rules where only Variable with string name property is being handled, but the code might find some improvements to the logic useful.

It was my first idea to fix the problem in the IssetCheck, however, the error being returned actually comes from DefinedVariableRule. Being new to the project, I don't yet understand how it all works. However, if you could tell me a little more about what you'd like to see added, there's no problem; I'm open to any suggestions.
I've added the tests as requested.

Copy link
Member

IssetCheck is used by IssetRule and others. Look at IssetRuleTest what it detects.

You should be able to produce some tests with $$ to see what's currently wrong about the behaviour.

ga-devfront reacted with thumbs up emoji

Copy link
Author

IssetCheck is used by IssetRule and others. Look at IssetRuleTest what it detects.

You should be able to produce some tests with $$ to see what's currently wrong about the behaviour.

As you can see, I added the tests in IssetRuleTest.php, but nothing is thrown.
Maybe I missed something, feel free to let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@ondrejmirtes ondrejmirtes Awaiting requested review from ondrejmirtes

1 more reviewer

@VincentLanglet VincentLanglet VincentLanglet approved these changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

[variable.undefined] Variable $wow might not be defined.

AltStyle によって変換されたページ (->オリジナル) /