PHPStan: Add additional unchecked exceptions #1681
Merged
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.
In many cases, we deliberately want a request to crash and trigger the error handler when an unexpected unrecoverable situation occurs. When PHPStan was first set up, the list of unchecked exceptions was kept to a minimum to allow us to decide which exceptions should be checked and which should be unchecked. After working with it for a few months, it's clear that a few more exception types need to be added.
It is possible that more exception types will need to be added to this list in the future. The goal is for PHPStan to be a useful tool which flags problems like division by zero exceptions, so they can be dealt with without crashing an entire request.