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

Null comparison detection stored on a variable not considered on if statement #801

Closed
soullivaneuh opened this issue Jan 26, 2018 · 4 comments
Labels

Comments

@soullivaneuh
Copy link
Contributor

soullivaneuh commented Jan 26, 2018

Summary of a problem or a feature request

When a null comparison is store on a variable, it not considered by PHPSTan.

It's a retry of #800. There is already #647 and #701 about assignments in conditions, but I'm not sure it's related. For my case, it's not directly an assignment but a comparison stored on a boolean variable.

See the sample. If it's indeed the same issue, sorry for that and feel free to close. 👍

Code snippet that reproduces the problem

https://phpstan.org/r/24dc69b2-908a-4137-842c-c4880a6d1f59

Expected output

Nothing.

@ondrejmirtes ondrejmirtes added this to the Constant values milestone Jan 26, 2018
@ondrejmirtes
Copy link
Member

Now that I see it, I don’t think it’s the same. Thanks.

@ondrejmirtes
Copy link
Member

This is fixed, but it needs a slightly modified example: https://phpstan.org/r/0de58ea4-35b0-4550-a775-1c604dff53f7

Fixed by: phpstan/phpstan-src@a9d5c8b

@szepeviktor
Copy link
Contributor

Dependent variables

Thank you for this feature.

I think a software is better if avoids this pattern.
@ondrejmirtes Is there a way to disable Dependent variables feature?

@github-actions
Copy link

github-actions bot commented May 3, 2021

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 May 3, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants