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.
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 anon-empty-stringcan still lead toempty($var)to beemptyas 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.