-
-
Notifications
You must be signed in to change notification settings - Fork 864
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
Problem assignin variable inside method is_null #2640
Comments
This bug report is missing a link to reproduction on phpstan.org. |
Yes, this is a bug, but you can easily go around it :) https://phpstan.org/r/917106e6-839c-43a0-aeff-a0c9153af49f |
Alternatively, you could use |
Related to (maybe duplicate of) #2413 |
@sdecandelario After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-12: Method HelloWorld::test() should return string but returns string|null.
+No errors |
Fixed: phpstan/phpstan-src@b2bf703 |
Closes phpstan/phpstan#4761 Closes phpstan/phpstan#3331 Closes phpstan/phpstan#3106 Closes phpstan/phpstan#2640 Closes phpstan/phpstan#2413 Closes phpstan/phpstan#3446
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. |
Bug report
When assign a variable inside a
is_null
function and then use this variable phpstan seems not to detect and considere that the variable can be nullCode snippet that reproduces the problem
https://phpstan.org/r/33610217-6278-4a1c-b2cc-dd9f9f837fcd
Expected output
No errors
The text was updated successfully, but these errors were encountered: