-
-
Notifications
You must be signed in to change notification settings - Fork 863
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
feature request: make sure an exception is used #3844
Comments
I'm not sure what you exactly mean without a code sample but I'd guess this package does what you want: https://github.com/pepakriz/phpstan-exception-rules/ |
I'd guess it can be generalized into "Calling a method that doesn't have a side effect - report when the returned value isn't used". |
No, I don't think so.
Yup, agreed. 👍 |
This now works, but the method returning the exception must be tagged with Implemented in: phpstan/phpstan-src#412 |
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. |
Feature request
In my code I'm using some static exception factory methods similar to Doctrine's ORMException. For instance:
Today I found out that in some cases my code only called the method but did nothing with the returned exception - the
throw
statement was missing.I'd like PHPStan to tell me about these "unused exception" cases.
The text was updated successfully, but these errors were encountered: