Make WordPress Core


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

    r47205 r47219  
    224224
    225225    if ( is_object( $object ) ) {
    226         if ( $object->post_type === 'attachment' ) {
     226        if ( 'attachment' === $object->post_type ) {
    227227            return get_attachment_taxonomies( $object, $output );
    228228        }
     
    881881    $_term->filter( $filter );
    882882
    883     if ( $output === ARRAY_A ) {
     883    if ( ARRAY_A === $output ) {
    884884        return $_term->to_array();
    885     } elseif ( $output === ARRAY_N ) {
     885    } elseif ( ARRAY_N === $output ) {
    886886        return array_values( $_term->to_array() );
    887887    }
     
    20122012        foreach ( $taxonomies as $index => $taxonomy ) {
    20132013            $t = get_taxonomy( $taxonomy );
    2014             if ( isset( $t->args ) && is_array( $t->args ) && $args != array_merge( $args, $t->args ) ) {
     2014            if ( isset( $t->args ) && is_array( $t->args ) && array_merge( $args, $t->args ) != $args ) {
    20152015                unset( $taxonomies[ $index ] );
    20162016                $terms = array_merge( $terms, wp_get_object_terms( $object_ids, $taxonomy, array_merge( $args, $t->args ) ) );
     
    31513151        }
    31523152
    3153         if ( $object_types == array_filter( $object_types, 'post_type_exists' ) ) {
     3153        if ( array_filter( $object_types, 'post_type_exists' ) == $object_types ) {
    31543154            // Only post types are attached to this taxonomy.
    31553155            _update_post_term_count( $terms, $taxonomy );
     
    40364036
    40374037    foreach ( array( 'default_category', 'default_link_category', 'default_email_category' ) as $option ) {
    4038         if ( $term_id === (int) get_option( $option, -1 ) ) {
     4038        if ( (int) get_option( $option, -1 ) === $term_id ) {
    40394039            update_option( $option, $new_term_id );
    40404040        }
Note: See TracChangeset for help on using the changeset viewer.