.. _classes-unresolvedcatch: .. _unresolved-catch: Unresolved Catch ++++++++++++++++ Catch clauses do not check for `Exception `_ existence. Catch clauses check that the emitted expression is of the requested Class, but if that class doesn't exist in the code, the catch clause is always false. This is dead code. .. code-block:: php See also `PHP Try Catch: Basics & Advanced PHP Exception Handling Tutorial `_ and `Silent failure to catch exceptions in PHP `_. Connex PHP features ------------------- + `try-catch `_ Suggestions ___________ * Fix the name of the exception * Remove the catch clause * Add a use expression with a valid name * Create/import the missing exception Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Classes/UnresolvedCatch | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`Dead code ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.4 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Major | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | High | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | ClearPHP | `no-unresolved-catch `__ | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+