-
-
Notifications
You must be signed in to change notification settings - Fork 454
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: lvl 1 -> 2 #1854
phpstan: lvl 1 -> 2 #1854
Conversation
path: src/DataCollector/DoctrineDataCollector.php | ||
# Probably needs Symfony plugin | ||
- message: '#Call to an undefined method Symfony\\Component\\Config\\Definition\\Builder\\Node#' | ||
path: src/DependencyInjection/Configuration.php |
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.
How do you make the choice to user ignoreErrors
vs phpstan-ignore
? Now that phpstan-ignore
comes with error identifier, I think it's good.
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.
This rule suppresses 10 violations. It's hard to make a hard rule out of it, but 10 violations of same kind I would say are sufficient. Once we solve underlying issue (like here, maybe it will be solved by symfony plugin), we can remove it from one place instead of hunting it all over. If it was like 3 violations, I would be more inclined to do it inline. But anything in between is subjective.
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.
Now that
phpstan-ignore
comes with error identifier
We can use those identifiers in the ignore rules of our neon file as well and we should probably do that.
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.
To elaborate, in the past I thought the baseline approach was superior, because using @phpstan-ignore-next-line
could hide more than the intended errors. Now that it's possible to do that directly in the code, I think it might be nicer to have the ignore rules close to the code, because sometimes I'm wondering why PHPStan "isn't working". Also, if you see an existing ignore rule in the code, you are more likely to challenge it, if you know how to properly fix it.
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.
Yes normally I prefer inline suppressions (and ask people to do it). There are bunch of issues that prevent us to do it efficiently unfortunately, for example it's not enough for phpstan to suppress missing class when instantiating it, phpstan is not smart enough to understand that if you ignore missing class it's also ok to ignore method calls on such class. So now you have to sprinkle code with suppressions each time such class is used as well. I would expect I can just suppress instantiating class that can be missing, instead of having to suppress dozens of other issues cascading from that as well.
30e9ec8
to
119c27d
Compare
No description provided.