-
-
Notifications
You must be signed in to change notification settings - Fork 942
Closed
Labels
Description
Feature request
Dead catch rule is currently evaluated using the whole combined type. If the catch block catches union of several exceptions, then as long as at least one of them is thrown, phpstan does not detect any error. It would be great if phpstan could detect those useless catches even inside union types.
Example: https://phpstan.org/r/544766d4-4ac3-4bce-946c-a4f0a340be55
In general, the catch type can get pretty complicated, but at least the most common use case - straight union of multiple types - could be unwrapped and analysed the same way as if written using individual catch blocks.
Did PHPStan help you today? Did it make you happy in any way?
❤️
Reactions are currently unavailable