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

Assigning the condition in a variable raises an error #2977

Closed
roukmoute opened this issue Feb 12, 2020 · 3 comments
Closed

Assigning the condition in a variable raises an error #2977

roukmoute opened this issue Feb 12, 2020 · 3 comments

Comments

@roukmoute
Copy link

Bug report

If I assign a condition in a variable or in a method, phpstan brings me up a false error, I think.

Code snippet that reproduces the problem

https://phpstan.org/r/488425af-8e61-453e-b327-1084560a8b3d

Expected output

https://phpstan.org/r/470bbfe6-0518-4ea2-ae05-68742135bae6

The only difference between theses two links is on line 54:

-if (!$case) {
+if (!$parent) {
@phpstan-bot
Copy link
Contributor

@roukmoute After the latest commit in dev-master, PHPStan now reports different result with your code snippet:

@@ @@
-58: Cannot call method getData() on MyInterface|null.
+No errors

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src@56ae015

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

No branches or pull requests

3 participants