-
Notifications
You must be signed in to change notification settings - Fork 4
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
Add error identifiers #41
Comments
Thanks for the suggestions. It looks good to me 👍 Could you send PR? |
I probably could but it's really not that hard given that you already require PHPStan ^1.11 (so error identifiers support is there and you don't need to support older versions that don't have it). It's as simple as calling identifier('X') in the right places, cf. |
Situation
I'm in a situation where I want to enable some/all checks this extension provides in general, but ignore specific cases.
Right now I can only use the old approach of either ignoring by regex via config or baseline, or add generic "ignore anything here"
@phpstan-ignore-line
/@phpstan-ignore-next-line
comments.What I want is to explicitly ignore a certain rule in specific places (see use case below).
For that I'd need support of error identifiers (e.g.
type_perfect.narrow_return
), cf.:https://phpstan.org/blog/phpstan-1-11-errors-identifiers-phpstan-pro-reboot
Use Case
I have a class that has properties with mutable types (interfaces containing methods that allow object mutation).
On the same class I have methods that return these properties but use immutable return types (interfaces that do not advertise methods capable of object mutation). These cases are correctly detected by
narrow_return
but I want to ignore these specific cases.The text was updated successfully, but these errors were encountered: