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
report swallowed exception #5627
Comments
There's already a rule for multiple We could apply it too to "this always thrown exception is shadowed by this |
experienced it 2 times within the last week. I will see whether I can provide a patch |
@staabm After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
-4: Function a() has no return typehint specified.
+4: Function a() has no return type specified. Full report
|
@ondrejmirtes After the latest commit in dev-master, PHPStan now reports different result with your code snippet: @@ @@
- 4: Function a() has no return typehint specified.
+ 4: Function a() has no return type specified.
6: This return is overwritten by a different one in the finally block below.
7: Dead catch - Exception is never thrown in the try block.
10: The overwriting return is on this line. Full report
|
Implemented: phpstan/phpstan-src@24c1eb4 + phpstan/phpstan-src@c362fc5 |
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
A exception thrown is swallowed when the
finally
block contains areturn
.I would expect a error regarding the thrown exception will be swallowed by the php runtime.
today we debugged a class and realized that our exceptions won't get thrown because of such a "finally-return".. its really suprising
https://3v4l.org/OiVkG#v7.4.23
https://phpstan.org/r/8685c7b2-5a0e-4fbb-9e46-dfcca31559b1
The text was updated successfully, but these errors were encountered: