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
Free-standing binary op exressions should be treated as equivalent "if" expressions #2741
Labels
Milestone
Comments
Associated Psalm fix: vimeo/psalm@bf67c03#diff-210d9c6ab20da8a7e5f6796f7090a6e7R82 |
@muglug PHPStan now reports different result with your code snippet: @@ @@
+PHP 7.2 – 8.0 (2 errors)
+==========
+
+ 9: Right side of || is always false.
+10: Function test() should return string but returns string|null.
+
+PHP 7.1 (3 errors)
+==========
+
+ 9: Only booleans are allowed in ||, string given on the right side.
9: Right side of || is always false.
10: Function test() should return string but returns string|null. Full reportPHP 7.2 – 8.0 (2 errors)
PHP 7.1 (3 errors)
|
@muglug PHPStan now reports different result with your code snippet: @@ @@
+PHP 7.4 – 8.0 (3 errors)
+==========
+
+ 9: Only booleans are allowed in &&, string given on the right side.
+ 9: Right side of && is always false.
+10: Function test() should return string but returns string|null.
+
+PHP 7.1 – 7.3 (2 errors)
+==========
+
9: Right side of && is always false.
10: Function test() should return string but returns string|null. Full reportPHP 7.4 – 8.0 (3 errors)
PHP 7.1 – 7.3 (2 errors)
|
Fixed: phpstan/phpstan-src@f9374e7 |
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
is directly equivalent to
Similarly,
is directly equivalent to
https://phpstan.org/r/de46736e-f6da-495a-ad3d-a1484626dfeb and
https://phpstan.org/r/ae3b7244-1720-4bf5-8bf3-5222caf2dacf
The text was updated successfully, but these errors were encountered: