-
-
Notifications
You must be signed in to change notification settings - Fork 947
False positive for empty on non-empty-string #7199
Copy link
Copy link
Closed
phpstan/phpstan-src
#1595Labels
Milestone
Description
Bug report
empty() in PHP is evil and behaves in mysterious ways. Particularly, as it basically is a check for truthy-ness, it considers the string "0" to be empty. That means that any variable/parameter that is a non-empty-string can still lead to empty($var) to be empty as well.
Code snippet that reproduces the problem
https://phpstan.org/r/5f809ad5-cee9-423c-b7aa-9ec2d432793a
Expected output
no error
Did PHPStan help you today? Did it make you happy in any way?
PHPStan still is one of my favorite gamified activities, and it helps me improve the code of my TYPO3 extensions and the TYPO3 core.
Reactions are currently unavailable