1.2.728. Multiple Catch With Try

This rule reports when a try structure have several catch statements. Usually, try structures have only one catch, so more catch clauses are worth checking.

<?php

// This try has several catch
try {
    doSomething();
} catch (RuntimeException $e) {
    processRuntimeException();
} catch (OtherException $e) {
    processOtherException();
}

?>

1.2.728.1. Connex PHP features

1.2.728.1.1. Specs

Short name

Structures/MultipleCatch

Rulesets

All, Appinfo, CE, Changed Behavior

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

High

Available in

Entreprise Edition, Community Edition, Exakat Cloud