Make WordPress Core


Ignore:
Timestamp:
02/09/2020 04:52:28 PM (7 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/po.php

    r47198 r47219  
    120120                        // Add empty string on first line for readbility.
    121121                        if ( false !== strpos( $string, $newline ) &&
    122                                 ( substr_count( $string, $newline ) > 1 || ! ( $newline === substr( $string, -strlen( $newline ) ) ) ) ) {
     122                                ( substr_count( $string, $newline ) > 1 || substr( $string, -strlen( $newline ) ) !== $newline ) ) {
    123123                                $po = "$quote$quote$newline$po";
    124124                        }
     
    295295                                        break;
    296296                                }
    297                                 if ( $res['entry']->singular == '' ) {
     297                                if ( '' == $res['entry']->singular ) {
    298298                                        $this->set_headers( $this->make_headers( $res['entry']->translations[0] ) );
    299299                                } else {
     
    318318                 */
    319319                protected static function is_final( $context ) {
    320                         return ( $context === 'msgstr' ) || ( $context === 'msgstr_plural' );
     320                        return ( 'msgstr' === $context ) || ( 'msgstr_plural' === $context );
    321321                }
    322322
     
    348348                                        }
    349349                                }
    350                                 if ( $line == "\n" ) {
     350                                if ( "\n" === $line ) {
    351351                                        continue;
    352352                                }
     
    360360                                        }
    361361                                        // Comments have to be at the beginning.
    362                                         if ( $context && $context != 'comment' ) {
     362                                        if ( $context && 'comment' !== $context ) {
    363363                                                return false;
    364364                                        }
     
    371371                                                break;
    372372                                        }
    373                                         if ( $context && $context != 'comment' ) {
     373                                        if ( $context && 'comment' !== $context ) {
    374374                                                return false;
    375375                                        }
     
    382382                                                break;
    383383                                        }
    384                                         if ( $context && $context != 'msgctxt' && $context != 'comment' ) {
     384                                        if ( $context && 'msgctxt' !== $context && 'comment' !== $context ) {
    385385                                                return false;
    386386                                        }
     
    388388                                        $entry->singular .= PO::unpoify( $m[1] );
    389389                                } elseif ( preg_match( '/^msgid_plural\s+(".*")/', $line, $m ) ) {
    390                                         if ( $context != 'msgid' ) {
     390                                        if ( 'msgid' !== $context ) {
    391391                                                return false;
    392392                                        }
     
    395395                                        $entry->plural   .= PO::unpoify( $m[1] );
    396396                                } elseif ( preg_match( '/^msgstr\s+(".*")/', $line, $m ) ) {
    397                                         if ( $context != 'msgid' ) {
     397                                        if ( 'msgid' !== $context ) {
    398398                                                return false;
    399399                                        }
     
    401401                                        $entry->translations = array( PO::unpoify( $m[1] ) );
    402402                                } elseif ( preg_match( '/^msgstr\[(\d+)\]\s+(".*")/', $line, $m ) ) {
    403                                         if ( $context != 'msgid_plural' && $context != 'msgstr_plural' ) {
     403                                        if ( 'msgid_plural' !== $context && 'msgstr_plural' !== $context ) {
    404404                                                return false;
    405405                                        }
Note: See TracChangeset for help on using the changeset viewer.