Make WordPress Core


Ignore:
Timestamp:
03/21/2021 12:39:25 PM (5 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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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 );
Note: See TracChangeset for help on using the changeset viewer.