.. _structures-impliedif: .. _implied-if: Implied If ++++++++++ It is confusing to emulate if/then with boolean operators. It is possible to emulate a if/then structure by using the operators 'and' and 'or'. Since optimizations will be applied to them : when the left operand of 'and' is false, the right one is not executed, as its `result `_ is useless; when the left operand of 'or' is true, the right one is not executed, as its `result `_ is useless; However, such structures are confusing. It is easy to misread them as conditions, and ignore an important logic step. It is recommended to use a real 'if then' structures, to make the condition readable. .. code-block:: php Suggestions ___________ * Replace this expression by an explicit if-then structure Specs _____ +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Structures/ImpliedIf | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`CE `, :ref:`CI-checks `, :ref:`Changed Behavior `, :ref:`Rector ` | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.4 | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Major | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Instant (5 mins) | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Precision | High | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | ClearPHP | `no-implied-if `__ | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Community Edition `_, `Exakat Cloud `_ | +--------------+--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+