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

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

Open
mad-briller opened this issue Jun 16, 2023 · 2 comments · May be fixed by phpstan/phpstan-src#2903
Labels
Milestone

Comments

@mad-briller
Copy link
Contributor

mad-briller commented Jun 16, 2023

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!

@ondrejmirtes ondrejmirtes added this to the Easy fixes milestone Jun 16, 2023
@ondrejmirtes
Copy link
Member

Yeah, this should work, it's going to be something trivial to fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants