.. _structures-usepositivecondition: .. _use-positive-condition: Use Positive Condition ++++++++++++++++++++++ Whenever possible, use a positive condition. Positive conditions are easier to understand, and lead to less understanding problems. Negative conditions are not reported when else is not present. .. code-block:: php See also `Double negatives should not not be avoided `_ and `How To Write Conditional Statements in PHP `_. Suggestions ___________ * Invert the code in the if branches, and the condition Specs _____ +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Short name | Structures/UsePositiveCondition | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Analyze `, :ref:`Changed Behavior ` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.6 | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Quick (30 mins) | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Examples | :ref:`case-spip-structures-usepositivecondition`, :ref:`case-expressionengine-structures-usepositivecondition` | +--------------+-------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+-------------------------------------------------------------------------------------------------------------------------+