.. _exceptions-cantthrow: .. _can't-implement-throwable: Can't Implement Throwable +++++++++++++++++++++++++ Classes extending ``Throwable`` can't be thrown, unless they also extend ``Exception``. The same applies to interfaces that extends ``Throwable``. Although such code lints, PHP throws a Fatal `error `_ when executing or including it : ``Class fooThrowable cannot implement interface `Throwable `_.php>`_, extend `Exception `_ or `Error `_ instead``. .. code-block:: php See also `Throwable `_, `Exception `_ and `Error `_. Related PHP errors ------------------- + `Class fooThrowable cannot implement interface Throwable, extend Exception or Error instead `_ Connex PHP features ------------------- + `throwable `_ + `error `_ + `exception `_ Suggestions ___________ * Extends the \Exception class * Extends the \Error class Specs _____ +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Exceptions/CantThrow | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`Changed Behavior `, :ref:`LintButWontExec ` | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 1.3.3 | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Slow (1 hour) | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Note | This issue may lint but will not run | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+------------------------------------------------------------------------------------------------------------------------------------------------------------------+