-
-
Notifications
You must be signed in to change notification settings - Fork 205
Closed
Description
This code fails the sniff even though it is valid because the exception is caught and not bubbled up.
class Foo {
public function __toString() {
try {
throw new \LogicException('should not trigger the sniff');
} catch (\Exception $e) {
// ...
}
}
}I fear that it's very hard to check that every thrown exception is really caught because of inheritance, but the sniff is already not a 100% safe because an exception could be raised in a method called in __toString.
So I'd say it's fair to just check if the exception is thrown inside a try block and not for a matching catch.
Reactions are currently unavailable