Skip to content

PHPStan does not understand destructuring assignment on objects that implement ArrayAccess  #9456

Open
phpstan/phpstan-src
#2903
@mad-briller

Description

Bug report

As you can see from the example i have pulled out of the Laravel source, when using partition a two element array is return which is typically destructured to get the desired values, however phpstan fails to understand it and sets the type to mixed

Code snippet that reproduces the problem

https://phpstan.org/r/eb33c0aa-469a-491a-9fc8-1138a9c923ad

Expected output

i have added assertType calls in the example for my expected output

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

you know!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions