mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #5796] Catch Throwable instead of just catching Exception
#9730
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Original Pull Request: https://github.com/doctrine/orm/pull/5796
State: closed
Merged: No
Several code blocks have a catch-all
catch (\Exception) { ... }. This is OK in PHP 5, but not sufficient in PHP 7, as the new base interface isThrowable, and catchingExceptiondoes not catchErrorinstances.This PR catches
Throwableby default, then catchesExceptionfor PHP 5. The fact thatThrowableis not defined in PHP 5 is not a problem in a catch block.This leads to a bit of code duplication, but there's not much we can do to avoid this I'm afraid.