.. _exceptions-unusedexceptionvariable: .. _unused-exception-variable: Unused Exception Variable +++++++++++++++++++++++++ The variable from a catch clause is not used. It is expected to be used, either by chaining the `exception `_, or logging the message. In PHP 8.0, this variable may be omitted. .. code-block:: php getMessage()); } catch (C) { // Caught and ignored (PHP 8.0 +) } ?> Connex PHP features ------------------- + `exception `_ Suggestions ___________ * Drop the variable in the clause expression (PHP 8.0 and more recent) * Chain the exception * Log the exception message Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Exceptions/UnusedExceptionVariable | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`Suggestions ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 2.2.0 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | High | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+