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
Assign readonly property value using list is not handled #7119
Comments
FYI @herndlm This one is worth investigating. The thing that we should take advantage of is that array destructuring is correctly handled in TypesAssignedToPropertiesRule so the readonly check should take advantage of PropertyAssignNode (ClassStatementsGatherer uses it to create PropertyWrite so I don't really know what's wrong). The array destructuring probably creates PropertyRead too which isn't desired. |
Yeah, sounds like you're guess is correct. I'm not entirely sure yet how to fix this, let me know if you have an idea already. Currently I'm looking into passing around |
Yes, that's probably the right way :) |
Thank you very much for taking care of this! You rock! |
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
When using the
list
syntax or its short version to assign values to readonly properties in a constructor, the assignation is not taken into account, and this creates a false positive.Code snippet that reproduces the problem
Here is an example of snippet that throws an error
Expected output
No error.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan is helping me everyday and I'll never thanks enough people who are making this better and better everyday! A huge THANK YOU!
The text was updated successfully, but these errors were encountered: