Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Follow up of the discussion 181f75c#r50600099
I try to add some ThrowTypeExtension. This one seems easy.
The others in https://github.com/pepakriz/phpstan-exception-rules/tree/master/src/Extension are
DOMDocumentExtension
: This one is half-wrong. It makes the code believe method can throw anErrorException
but I discover it only throw aWarning
and the error handler is transforming this toErrorException
when usingAPP_DEBUG=true
with Symfony. Still, empty string will throw an error in PHP8.http://sandbox.onlinephpfunctions.com/code/9a26ff8a86809b4e9848d9635ec0debeee36e355.
IntdivExtension
JsonEncodeDecodeExtension
ReflectionExtension
SimpleXMLElementExtension
SplFileObjectExtension
I'll try to add more after this PR.
First I'd like to understand something @ondrejmirtes. When I'm returning
I assume this rely on the fact that the exception which can be thrown by the method is well documented. Where can I check if it is ? Do you rely on Phpstorm stubs ?
Does it means for instance that intdiv is not considered as throwing an exception because the phpdoc does not contains
throws
tag ?