.. _structures-unconditionloopbreak: .. _unconditional-break-in-loop: Unconditional Break In Loop +++++++++++++++++++++++++++ An unconditional `break `_ in a loop creates dead code. Since the `break `_ is directly in the body of the loop, it is always executed, creating a strange loop that can only run once. Here, `break `_ may also be a return, a goto or a `continue `_. They all branch out of the loop. Such statement are valid, but should be moderated with a condition. .. code-block:: php Connex PHP features ------------------- + `loop `_ + `break `_ Suggestions ___________ * Remove the loop and call the content of the loop once. Specs _____ +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Structures/UnconditionLoopBreak | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`CE `, :ref:`CI-checks ` | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.12.16 | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Major | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Examples | :ref:`case-livezilla-structures-unconditionloopbreak`, :ref:`case-mediawiki-structures-unconditionloopbreak` | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Community Edition `_, `Exakat Cloud `_ | +--------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+