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

Dependent variables not working if dependency referenced in another condition #5401

Closed
Tracked by #8360
brandonkelly opened this issue Jul 31, 2021 · 2 comments · Fixed by phpstan/phpstan-src#1950
Closed
Tracked by #8360

Comments

@brandonkelly
Copy link

brandonkelly commented Jul 31, 2021

Bug report

Dependent variable support (added in 0.12.64) dosen’t work properly if the variable used in the dependency condition is referenced in an additional condition before the dependent variable check kicks in.

Code snippet that reproduces the problem

Here’s two simple examples:

Expected output

There shouldn’t be any reported errors here.

Did PHPStan help you today? Did it make you happy in any way?

I was prepared to have to start refactoring all the places where we are using dependent variables to make PHPStan happy, and was pleasantly surprised to find that there’s some basic support for it already!

@brandonkelly
Copy link
Author

PhpStorm has a similar bug, FWIW. Here’s a couple more examples of the bug, pulled from that report:

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Dec 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants