-
Notifications
You must be signed in to change notification settings - Fork 19
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
Exception improvements #33
Comments
TODO: need to update README. |
|
and need to update the neon file. |
Rethrowing exceptions is a rare use case for me, because my middleware has to catch and handle them anyway. By the way: I've heard that rethrowing exceptions is considered an anti-pattern (catch, log, throw again). How can I disable this rule? |
Indeed, if you are developing a middleware, this specific rule does not apply. In the meantime, you can ignore the error message with a regular expression: https://github.com/phpstan/phpstan#ignore-error-messages-with-regular-expressions |
@moufmouf ability to disable certain rules in a way such as PHPMD and other does would be really appreciated as well. I might want to disable a rule for a specific use case in a class (knowing what I'm doing) but leave it on for the rest of the code base If you find this appealing an issue can be created to discuss what and how |
@juliangut I would absolutely love to have the possibility to disable a rule for a specific use case (a specific method or class) but I believe this ability should be part of PHPStan (and not the phpstan-strict-rules extension). Maybe open an issue to PHPStan? |
You're right! |
When catching
Exception
,Throwable
orRuntimeException
, we should ensure that the exception is always rethrown (or wrapped into another exception that is thrown).The text was updated successfully, but these errors were encountered: