-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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 analysis error when using GuzzleException #1971
Comments
Hi, author of PHPStan here. You should:
|
Maintainers of Guzzle can feel free to close this issue 😊 |
Thank you @ondrejmirtes ! I saw there was some stuff done for Guzzle, but did not saw this problematic. I am closing the issue. |
@ondrejmirtes just as a follow-up on this. Since
Should the |
@rvanlaak Throwable interface can not be extended by userland interfaces. neither can it be implemented by userland classes. |
@babaorum This definitely isn’t true, you can define interface X extends \Throwable. |
Actual Behavior
Experiencing error with phpstan like those with level analysis >= 5
Expected Behavior
No error found.
Steps to Reproduce
I am catching
GuzzleException
like this.with a custom exception like this :
Possible Solutions
The problem seems to be that
GuzzleException
does not extends \Exception directly. And there is no guarantee that every class that will implementGuzzleException
will extend\Exception
.For me, the problem could be solved by changing GuzzleException into an abstract class which will extends
\RuntimeException
since it is the actual extended exception.The text was updated successfully, but these errors were encountered: