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

False positove Variable might not be defined. #11044

Closed
integer opened this issue May 16, 2024 · 2 comments
Closed

False positove Variable might not be defined. #11044

integer opened this issue May 16, 2024 · 2 comments

Comments

@integer
Copy link
Contributor

integer commented May 16, 2024

Bug report

In attached snippet is code which use one variable as a boolean flag if another variable is set. But PHPStan ignores this flag.

Code snippet that reproduces the problem

https://phpstan.org/r/320b10b5-ad0a-43a3-889d-8114fbc27ead

Expected output

No errors

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

Today? Many times! Thanks.

@voku
Copy link
Contributor

voku commented May 17, 2024

Why do you not just check if $visibilityModeLabel is set? Less cognitive load and no more phpstan error. 😉

@integer
Copy link
Contributor Author

integer commented May 17, 2024

Yes code can be simplified and phpstan can understand it better even in our codebase. Thanks for push to this way.

@integer integer closed this as completed May 17, 2024
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

No branches or pull requests

2 participants