Skip to content

Array key does not change type after using sort #10595

@imhdCePo

Description

@imhdCePo

Bug report

Hello,

Recent change in return type of sort causes following problem:
https://phpstan.org/r/da32d2f1-4f3c-476f-b381-c3a7775c03da

When line 8 is commented out, it works as expected. Sort now returns list as a type. Line 9 changes type to string. Therefore line 10 should not have any errors.

I think it breaks only if arrays have more dimensions like in the example.

Code snippet that reproduces the problem

https://phpstan.org/r/da32d2f1-4f3c-476f-b381-c3a7775c03da

Expected output

No errors

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

Absolutely, I can't live without it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions