Yoda conditions

In programming jargon, Yoda conditions (also called Yoda notation) is a programming style where the two parts of an expression are reversed from the typical order in a conditional statement. A Yoda condition places the constant portion of the expression on the left side of the conditional statement.

Yoda conditions are part of the coding standards for Symfony[1] and WordPress.[2]

  1. ^ "Coding Standards (Contributing to Symfony)". Symfony.com. Retrieved 12 November 2016.
  2. ^ "PHP Coding Standards | Coding Standards Handbook". WordPress Developer Resources. Retrieved 25 July 2021.