Make WordPress Core

Changeset 50558


Ignore:
Timestamp:
03/21/2021 12:39:25 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison for return type checks in a few functions:

  • get_bookmark()
  • get_comment()
  • get_post()
  • get_children()
  • wp_get_recent_posts()
  • wp_get_post_revision()
  • wp_get_nav_menu_items()

Follow-up to [45710] for get_term(), [48507] for wpdb::get_row() and wpdb::get_results().

See #52627.

Location:
trunk/src/wp-includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/bookmark.php

    r48591 r50558  
    5454    $_bookmark = sanitize_bookmark( $_bookmark, $filter );
    5555
    56     if ( OBJECT == $output ) {
     56    if ( OBJECT === $output ) {
    5757        return $_bookmark;
    58     } elseif ( ARRAY_A == $output ) {
     58    } elseif ( ARRAY_A === $output ) {
    5959        return get_object_vars( $_bookmark );
    60     } elseif ( ARRAY_N == $output ) {
     60    } elseif ( ARRAY_N === $output ) {
    6161        return array_values( get_object_vars( $_bookmark ) );
    6262    } else {
  • trunk/src/wp-includes/comment.php

    r50533 r50558  
    219219    $_comment = apply_filters( 'get_comment', $_comment );
    220220
    221     if ( OBJECT == $output ) {
     221    if ( OBJECT === $output ) {
    222222        return $_comment;
    223     } elseif ( ARRAY_A == $output ) {
     223    } elseif ( ARRAY_A === $output ) {
    224224        return $_comment->to_array();
    225     } elseif ( ARRAY_N == $output ) {
     225    } elseif ( ARRAY_N === $output ) {
    226226        return array_values( $_comment->to_array() );
    227227    }
  • trunk/src/wp-includes/nav-menu.php

    r50013 r50558  
    759759    }
    760760
    761     if ( ARRAY_A == $args['output'] ) {
     761    if ( ARRAY_A === $args['output'] ) {
    762762        $items = wp_list_sort(
    763763            $items,
     
    766766            )
    767767        );
    768         $i     = 1;
     768
     769        $i = 1;
     770
    769771        foreach ( $items as $k => $item ) {
    770772            $items[ $k ]->{$args['output_key']} = $i++;
  • trunk/src/wp-includes/post.php

    r50538 r50558  
    678678    }
    679679
    680     if ( OBJECT == $output ) {
     680    if ( OBJECT === $output ) {
    681681        return $kids;
    682     } elseif ( ARRAY_A == $output ) {
     682    } elseif ( ARRAY_A === $output ) {
    683683        $weeuns = array();
    684684        foreach ( (array) $kids as $kid ) {
     
    686686        }
    687687        return $weeuns;
    688     } elseif ( ARRAY_N == $output ) {
     688    } elseif ( ARRAY_N === $output ) {
    689689        $babes = array();
    690690        foreach ( (array) $kids as $kid ) {
     
    789789    $_post = $_post->filter( $filter );
    790790
    791     if ( ARRAY_A == $output ) {
     791    if ( ARRAY_A === $output ) {
    792792        return $_post->to_array();
    793     } elseif ( ARRAY_N == $output ) {
     793    } elseif ( ARRAY_N === $output ) {
    794794        return array_values( $_post->to_array() );
    795795    }
     
    36933693
    36943694    // Backward compatibility. Prior to 3.1 expected posts to be returned in array.
    3695     if ( ARRAY_A == $output ) {
     3695    if ( ARRAY_A === $output ) {
    36963696        foreach ( $results as $key => $result ) {
    36973697            $results[ $key ] = get_object_vars( $result );
  • trunk/src/wp-includes/revision.php

    r49108 r50558  
    372372    }
    373373
    374     if ( OBJECT == $output ) {
     374    if ( OBJECT === $output ) {
    375375        return $revision;
    376     } elseif ( ARRAY_A == $output ) {
     376    } elseif ( ARRAY_A === $output ) {
    377377        $_revision = get_object_vars( $revision );
    378378        return $_revision;
    379     } elseif ( ARRAY_N == $output ) {
     379    } elseif ( ARRAY_N === $output ) {
    380380        $_revision = array_values( get_object_vars( $revision ) );
    381381        return $_revision;
Note: See TracChangeset for help on using the changeset viewer.