Skip to content
New issue

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

usort converts array to list #10423

Closed
rieschl opened this issue Jan 12, 2024 · 2 comments
Closed

usort converts array to list #10423

rieschl opened this issue Jan 12, 2024 · 2 comments
Labels
Milestone

Comments

@rieschl
Copy link

rieschl commented Jan 12, 2024

Bug report

When usorting an array, the array gets converted to a list, but PHPStan thinks it is not.
It seems that PHPStorm inspects the array before sorting it, maybe because usort takes the array as reference?

Code snippet that reproduces the problem

https://phpstan.org/r/8f5bf8e6-ba7a-4180-a1cf-7adf0a57fe0a

Expected output

There should be no issue detected.
The same snippet executed in PHP (https://3v4l.org/nHSkZ) results in no error

Did PHPStan help you today? Did it make you happy in any way?

PHPStan is aweseome! Thanks for your hard work. We use it in our projects for a long time now, with level: max and strict rules 👍

@ondrejmirtes
Copy link
Member

Fixed: phpstan/phpstan-src#2891

Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants