You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When an array with possible null values is filtered with array_filter and then the first entry is fetched with reset, PHPStan thinks that the array cannot be empty and will emit an error on a === false check.
I tried it on version 1.8.4. 1.8.3 outputs the same error, but 1.8.2 does not.
PHP version 7.4.30
Bug report
When an array with possible
null
values is filtered witharray_filter
and then the first entry is fetched withreset
, PHPStan thinks that the array cannot be empty and will emit an error on a=== false
check.I tried it on version
1.8.4
.1.8.3
outputs the same error, but1.8.2
does not.PHP version
7.4.30
Code snippet that reproduces the problem
https://phpstan.org/r/808dcfd1-17d2-4a54-8cf7-defb3d90dbb1
Expected output
PHPStan should not output an error because
reset
indeed can returnfalse
.Did PHPStan help you today? Did it make you happy in any way?
PHPStan helps me every time I write some code because it reminds me that there are things to consider I didn't think about 🙂
The text was updated successfully, but these errors were encountered: