Make WordPress Core


Ignore:
Timestamp:
02/09/2020 04:52:28 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use Yoda conditions where appropriate.

See #49222.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/pomo/plural-forms.php

    r47122 r47219  
    126126                    while ( ! empty( $stack ) ) {
    127127                        $o2 = $stack[ count( $stack ) - 1 ];
    128                         if ( $o2 !== '(' ) {
     128                        if ( '(' !== $o2 ) {
    129129                            $output[] = array( 'op', array_pop( $stack ) );
    130130                            continue;
     
    163163
    164164                        // Ternary is right-associative in C.
    165                         if ( $operator === '?:' || $operator === '?' ) {
     165                        if ( '?:' === $operator || '?' === $operator ) {
    166166                            if ( self::$op_precedence[ $operator ] >= self::$op_precedence[ $o2 ] ) {
    167167                                break;
     
    184184                    while ( $s_pos >= 0 ) {
    185185                        $o2 = $stack[ $s_pos ];
    186                         if ( $o2 !== '?' ) {
     186                        if ( '?' !== $o2 ) {
    187187                            $output[] = array( 'op', array_pop( $stack ) );
    188188                            $s_pos--;
     
    217217        while ( ! empty( $stack ) ) {
    218218            $o2 = array_pop( $stack );
    219             if ( $o2 === '(' || $o2 === ')' ) {
     219            if ( '(' === $o2 || ')' === $o2 ) {
    220220                throw new Exception( 'Mismatched parentheses' );
    221221            }
     
    260260            $next = $this->tokens[ $i ];
    261261            $i++;
    262             if ( $next[0] === 'var' ) {
     262            if ( 'var' === $next[0] ) {
    263263                $stack[] = $n;
    264264                continue;
    265             } elseif ( $next[0] === 'value' ) {
     265            } elseif ( 'value' === $next[0] ) {
    266266                $stack[] = $next[1];
    267267                continue;
Note: See TracChangeset for help on using the changeset viewer.