-
Notifications
You must be signed in to change notification settings - Fork 236
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
Ignore complaints about dead code #495
Conversation
What issue does this fix exactly? |
The issue is not very clearly expressed:
Since the phpdoc says |
While there isn't a baseline file, you can find |
But those "errors" happen during input validation where we handle exactly the cases that we declare unacceptable in the doc blocks that you're about to change. Psalm complaining about input validation is just Psalm being Psalm. I would simply ignore them. |
Ok, let me adjust. |
We've declared types in phpdoc, but they are not enforced by type declarations, so we are enforcing them with checks. Psalm complains it is dead code because it assumes the types can be trusted.
@SenseException I did the Psalm equivalent of what you mentioned. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The PR title needs to be adjusted though.
In the code of these constructors, we are checking the type of the 'value' property of the '$values' array.Let us reflect the fact that we are not assuming the type in the phpdoc. I think this is OK because since both of these classes are used as Doctrine annotations, there is no way for such precise types to be useful for the end user anyway. I chose that over creating a baseline for a project that does not have one yet.
We've declared types in phpdoc, but they are not enforced by type
declarations, so we are enforcing them with checks. Psalm complains it
is dead code because it assumes the types can be trusted.
This addresses a Psalm issue I spotted while reviewing #494