-
-
Notifications
You must be signed in to change notification settings - Fork 861
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 positive in Property Class::$property is never read, only written
-rule when using empty()
#5971
Comments
Same thing with |
That's true. Using a non-boolean property for boolean checks is not really "good/clean" code. An alternative error like Also: this error doesn't happen when using |
the same problem when using null coalesce ( |
fixes phpstan/phpstan#6107 fixes phpstan/phpstan#5971 fixes phpstan/phpstan#6899
fixes phpstan/phpstan#6107 fixes phpstan/phpstan#5971 fixes phpstan/phpstan#6899
fixes phpstan/phpstan#6107 fixes phpstan/phpstan#5971
fixes phpstan/phpstan#6107 fixes phpstan/phpstan#5971
fixes phpstan/phpstan#6107 fixes phpstan/phpstan#5971
Fixed: phpstan/phpstan-src#1174 |
Thank you! 🥇 |
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
Rule
Property Class::$property is never read, only written
reports a false-positive when the class-property is "read" withempty()
.Code snippet that reproduces the problem
https://phpstan.org/r/89c4e6d0-5ef4-492b-95fb-f0b7ed51a8ca
Expected output
There is no error when a class-property is "read" via
empty()
.Did PHPStan help you today? Did it make you happy in any way?
PHPStan v1 new rules are awesome. 👍
The text was updated successfully, but these errors were encountered: