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
Strict check when writing to array #3703
Labels
Milestone
Comments
Arrays are not typed this way, only when:
This has been discussed before #3269 |
Like this? https://phpstan.org/r/5866015d-9773-4f2b-a564-ba471fb8a2d9 |
@eigan After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-21: Array (array<string, array<string, array<int>>>) does not accept string.
+15: Property Foo::$bar (array<string, array<string, array<int>>>) does not accept array<string, array<string, array<int, string>>>.
+18: Property Foo::$bar (array<string, array<string, array<int>>>) does not accept array<string, array<string, int>>.
+21: Property Foo::$bar (array<string, array<string, array<int>>>) does not accept array<string, string>. Full report
|
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. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Bug/Feature report
Writing to array should verify that the type is correct.
Code snippet that reproduces the problem
https://phpstan.org/r/d6bd5e2f-c8e7-4b07-b0ab-dc02940c71e4
Expected output
Not sure how to handle
$array = []
.Relates to #3311 though it looks to be specific to non-keyed arrays.
The text was updated successfully, but these errors were encountered: