-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
Since release 1.10.59 the following code is considered erroneous (in bleeding edge mode):
$list = ['A', 'C', 'B'];
natcasesort($list);
array_values($list);The error is:
Parameter #1 $array (array{'A', 'C', 'B'}) of array_values is already a list, call has no effect.
However, the keys of $list are [0, 2, 1] after the call to natcasesort() so array_values does have an effect.
Code snippet that reproduces the problem
https://phpstan.org/r/ca0016cb-97aa-4a95-9bd0-6aced40c30f2
Expected output
No errors should be reported, as array_values() can be useful after natcasesort.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan found several calls to array_values() that were indeed unnecessary. Thanks!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels