MIR1508
UnreachableCatch
A catch block is unreachable because a more general exception type is caught before a more specific one. Exception types should be ordered from most specific to most general.
Example
Section titled “Example”<?phptry { // Some code} catch (Exception $e) { // General catch} catch (InvalidArgumentException $e) { // This is unreachable - Exception already caught}How to fix
Section titled “How to fix”Order catch blocks from most specific to most general:
<?phptry { // Some code} catch (InvalidArgumentException $e) { // Specific catch first} catch (Exception $e) { // General catch last}