1.2.122. Caught Expressions

This rule lists all the caught exceptions.

Exceptions may be caught by a code, while the same code never throw them.

<?php

// This analyzer reports MyException and Exception
try {
    doSomething();
} catch (MyException $e) {
    fixIt();
} catch (\Exception $e) {
    fixIt();
}

?>

See also Exceptions.

1.2.122.1. Specs

Short name

Php/TryCatchUsage

Rulesets

All, Appinfo, CE

Exakat since

0.8.4

PHP Version

All

Severity

Time To Fix

Precision

Very high

Features

catch

Available in

Entreprise Edition, Community Edition, Exakat Cloud