-
-
Notifications
You must be signed in to change notification settings - Fork 862
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 probably wrong understand the ArrayAccess #7619
Comments
I think the structure of your This example works https://phpstan.org/r/6706c2de-ab6d-4deb-a3a4-c0241cf8679a |
@staabm Unfortunately no. The mechanism you described is also correct, but I really try to set the |
A direct call maybe makes the problem clearer: https://phpstan.org/r/8755cdcd-66a3-46cd-b20f-4bb9f9327c89 Your only valid offset is |
Ok, maybe better syntax should be: https://phpstan.org/r/b800de73-0f2a-4e29-bb44-649c5f9e2220 Description on line 43 describe the inner array structure:
where the internal array can contain the key And the documentation on line 13
said, that it can be Now the error code is correct
So if I understand well, the „correct“ definition should be: https://phpstan.org/r/d67d278a-69ff-4b2e-b37d-68b60e72b766 Because there is no possibility to describe this? |
Does this help you? https://phpstan.org/r/95a7bcea-3198-4297-8770-823861adacfb From: #7650 |
@ondrejmirtes I think that the message that there is no possibility to define what I'm expecting helps me. Because what I need to say is, that the I need to allow $var = [
'foo' => [
'bar' => (object) [
'baz' => 42
]
]
] which is impossible to describe in I'm closing the ticket as "impossible request" ;) Thanks anyway for your time and patience |
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. |
Bug report
In this short example the phpstan return the following errors but it should be OK :)
Code snippet that reproduces the problem
https://phpstan.org/r/e7080419-7d11-4124-b49d-84b9f36cf404
Expected output
Expected result is, that the code works well.
https://3v4l.org/GL0bM#v8.0.21
Did PHPStan help you today? Did it make you happy in any way?
PHPStan and @ondrejmirtes helps me many times :) Thanks much
The text was updated successfully, but these errors were encountered: