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/post.php

    r47203 r47219  
    677677        }
    678678
    679         if ( $output == OBJECT ) {
     679        if ( OBJECT == $output ) {
    680680                return $kids;
    681         } elseif ( $output == ARRAY_A ) {
     681        } elseif ( ARRAY_A == $output ) {
    682682                $weeuns = array();
    683683                foreach ( (array) $kids as $kid ) {
    … …  
    685685                }
    686686                return $weeuns;
    687         } elseif ( $output == ARRAY_N ) {
     687        } elseif ( ARRAY_N == $output ) {
    688688                $babes = array();
    689689                foreach ( (array) $kids as $kid ) {
    … …  
    785785        $_post = $_post->filter( $filter );
    786786
    787         if ( $output == ARRAY_A ) {
     787        if ( ARRAY_A == $output ) {
    788788                return $_post->to_array();
    789         } elseif ( $output == ARRAY_N ) {
     789        } elseif ( ARRAY_N == $output ) {
    790790                return array_values( $_post->to_array() );
    791791        }
    … …  
    18071807                $ptype_obj = get_post_type_object( $ptype );
    18081808                // Sub-menus only.
    1809                 if ( ! $ptype_obj->show_in_menu || $ptype_obj->show_in_menu === true ) {
     1809                if ( ! $ptype_obj->show_in_menu || true === $ptype_obj->show_in_menu ) {
    18101810                        continue;
    18111811                }
    … …  
    42144214        }
    42154215
    4216         if ( $postarr['post_type'] == 'attachment' ) {
     4216        if ( 'attachment' === $postarr['post_type'] ) {
    42174217                return wp_insert_attachment( $postarr, false, 0, $wp_error );
    42184218        }
    … …  
    49604960                         * ensuring each matches the post ancestry.
    49614961                         */
    4962                         while ( $p->post_parent != 0 && isset( $pages[ $p->post_parent ] ) ) {
     4962                        while ( 0 != $p->post_parent && isset( $pages[ $p->post_parent ] ) ) {
    49634963                                $count++;
    49644964                                $parent = $pages[ $p->post_parent ];
    … …  
    49694969                        }
    49704970
    4971                         if ( $p->post_parent == 0 && $count + 1 == count( $revparts ) && $p->post_name == $revparts[ $count ] ) {
     4971                        if ( 0 == $p->post_parent && count( $revparts ) == $count + 1 && $p->post_name == $revparts[ $count ] ) {
    49724972                                $foundid = $page->ID;
    49734973                                if ( $page->post_type == $post_type ) {
    … …  
    67486748        global $wpdb;
    67496749
    6750         if ( $old_status != 'publish' && $new_status == 'publish' ) {
     6750        if ( 'publish' !== $old_status && 'publish' === $new_status ) {
    67516751                // Reset GUID if transitioning to publish and it is empty.
    67526752                if ( '' == get_the_guid( $post->ID ) ) {
Note: See TracChangeset for help on using the changeset viewer.