We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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.
$list
[0, 2, 1]
natcasesort()
array_values
https://phpstan.org/r/ca0016cb-97aa-4a95-9bd0-6aced40c30f2
No errors should be reported, as array_values() can be useful after natcasesort.
array_values()
natcasesort
PHPStan found several calls to array_values() that were indeed unnecessary. Thanks!
The text was updated successfully, but these errors were encountered:
Fixed: phpstan/phpstan-src@034f731
Sorry, something went wrong.
Thanks!
This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.
No branches or pull requests
Bug report
Since release 1.10.59 the following code is considered erroneous (in bleeding edge mode):
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 tonatcasesort()
soarray_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 afternatcasesort
.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!The text was updated successfully, but these errors were encountered: