.. _structures-yodacomparison: .. _yoda-comparison: Yoda Comparison +++++++++++++++ Yoda comparison is a way to write conditions which places literal values on the left side. The objective is to avoid mistaking a comparison to an assignation. If the comparison operator is mistaken, but the literal is on the left, then an `error `_ will be triggered, instead of a silent bug. . .. code-block:: php See also `Yoda Conditions `_ and `Yoda Conditions: To Yoda or Not to Yoda `_. Specs _____ +--------------+--------------------------------------------------------------------------------------------------------------------------------------+ | Short name | Structures/YodaComparison | +--------------+--------------------------------------------------------------------------------------------------------------------------------------+ | Rulesets | :ref:`All `, :ref:`Changed Behavior `, :ref:`Coding conventions ` | +--------------+--------------------------------------------------------------------------------------------------------------------------------------+ | Exakat since | 0.8.4 | +--------------+--------------------------------------------------------------------------------------------------------------------------------------+ | PHP Version | All | +--------------+--------------------------------------------------------------------------------------------------------------------------------------+ | Severity | Minor | +--------------+--------------------------------------------------------------------------------------------------------------------------------------+ | Time To Fix | Slow (1 hour) | +--------------+--------------------------------------------------------------------------------------------------------------------------------------+ | Precision | Very high | +--------------+--------------------------------------------------------------------------------------------------------------------------------------+ | Available in | `Entreprise Edition `_, `Exakat Cloud `_ | +--------------+--------------------------------------------------------------------------------------------------------------------------------------+