Skip to content

usort converts array to list #10423

@rieschl

Description

@rieschl

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 👍

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions