Coding Standards: Use Yoda conditions where appropriate.
See #49222. Built from https://develop.svn.wordpress.org/trunk@47219 git-svn-id: http://core.svn.wordpress.org/trunk@47019 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
@@ -125,7 +125,7 @@ class Plural_Forms {
|
||||
$found = false;
|
||||
while ( ! empty( $stack ) ) {
|
||||
$o2 = $stack[ count( $stack ) - 1 ];
|
||||
if ( $o2 !== '(' ) {
|
||||
if ( '(' !== $o2 ) {
|
||||
$output[] = array( 'op', array_pop( $stack ) );
|
||||
continue;
|
||||
}
|
||||
@@ -162,7 +162,7 @@ class Plural_Forms {
|
||||
$o2 = $stack[ count( $stack ) - 1 ];
|
||||
|
||||
// Ternary is right-associative in C.
|
||||
if ( $operator === '?:' || $operator === '?' ) {
|
||||
if ( '?:' === $operator || '?' === $operator ) {
|
||||
if ( self::$op_precedence[ $operator ] >= self::$op_precedence[ $o2 ] ) {
|
||||
break;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ class Plural_Forms {
|
||||
$s_pos = count( $stack ) - 1;
|
||||
while ( $s_pos >= 0 ) {
|
||||
$o2 = $stack[ $s_pos ];
|
||||
if ( $o2 !== '?' ) {
|
||||
if ( '?' !== $o2 ) {
|
||||
$output[] = array( 'op', array_pop( $stack ) );
|
||||
$s_pos--;
|
||||
continue;
|
||||
@@ -216,7 +216,7 @@ class Plural_Forms {
|
||||
|
||||
while ( ! empty( $stack ) ) {
|
||||
$o2 = array_pop( $stack );
|
||||
if ( $o2 === '(' || $o2 === ')' ) {
|
||||
if ( '(' === $o2 || ')' === $o2 ) {
|
||||
throw new Exception( 'Mismatched parentheses' );
|
||||
}
|
||||
|
||||
@@ -259,10 +259,10 @@ class Plural_Forms {
|
||||
while ( $i < $total ) {
|
||||
$next = $this->tokens[ $i ];
|
||||
$i++;
|
||||
if ( $next[0] === 'var' ) {
|
||||
if ( 'var' === $next[0] ) {
|
||||
$stack[] = $n;
|
||||
continue;
|
||||
} elseif ( $next[0] === 'value' ) {
|
||||
} elseif ( 'value' === $next[0] ) {
|
||||
$stack[] = $next[1];
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user