phpstan
phpstan copied to clipboard
Bogus error when using empty in combination with ArrayObject
Bug report
https://phpstan.org/r/26a6a63c-d15b-4e51-b4b5-17ae50979c58
When you generate an array from ArrayObject->getArrayCopy() phpstan is unable to identify emptyness
Expression in empty() is always falsy.
Code snippet that reproduces the problem
https://phpstan.org/r/26a6a63c-d15b-4e51-b4b5-17ae50979c58
Expected output
No errors
Did PHPStan help you today? Did it make you happy in any way?
👍
@ondrejmirtes isn't the root cause here the same as what was asked in https://github.com/phpstan/phpstan/discussions/8511#discussion-465317?
UPDATE: looks like you're normally linking to https://github.com/phpstan/phpstan/issues/6732#issuecomment-1062029088 :)
Yes it is 😊
So far you can do https://phpstan.org/r/6c18d3d3-e29c-41aa-b628-d826286859ec @colorvamp