-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
phpstan/phpstan-src
#4294Labels
Milestone
Description
Bug report
array_shift can return null if the array is empty, and also make it empty if there was a last element. phpstan allows using array_shift even when there is a last element left in the array for the non-empty-list field type.
As a result, we have an empty list in the non-empty-list field, and we expect that array_shift will never return null.
Code snippet that reproduces the problem
https://phpstan.org/r/e92d9e9d-0f01-42d5-b04f-337ca8c64157
Expected output
error in test2
the reason is to make sure that there is more than one element in the array
Did PHPStan help you today? Did it make you happy in any way?
No response
Reactions are currently unavailable