.. _structures-noreturninfinally: .. _no-return-or-throw-in-finally: No Return Or Throw In Finally +++++++++++++++++++++++++++++ Avoid using return and throw in a finally block. Both command will interrupt the processing of the try catch block, and any `exception `_ that was emitted will not be processed. This leads to unprocessed exceptions, leaving the application in an unstable state. Note that PHP prevents the usage of goto, `break `_ and `continue `_ within the finally block at linting phase. This is categorized as a Security problem. .. code-block:: php See also `Return Inside Finally Block `_. Connex PHP features ------------------- + `finally `_ + `return `_ Suggestions ___________ * Move the return right after the try/catch/finally call Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Structures/NoReturnInFinally | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`Security ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.12.1 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Major | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+