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. Built from https://develop.svn.wordpress.org/trunk@50558 git-svn-id: http://core.svn.wordpress.org/trunk@50171 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d72f4e0e48
commit
5e10227d76
|
@ -53,11 +53,11 @@ function get_bookmark( $bookmark, $output = OBJECT, $filter = 'raw' ) {
|
||||||
|
|
||||||
$_bookmark = sanitize_bookmark( $_bookmark, $filter );
|
$_bookmark = sanitize_bookmark( $_bookmark, $filter );
|
||||||
|
|
||||||
if ( OBJECT == $output ) {
|
if ( OBJECT === $output ) {
|
||||||
return $_bookmark;
|
return $_bookmark;
|
||||||
} elseif ( ARRAY_A == $output ) {
|
} elseif ( ARRAY_A === $output ) {
|
||||||
return get_object_vars( $_bookmark );
|
return get_object_vars( $_bookmark );
|
||||||
} elseif ( ARRAY_N == $output ) {
|
} elseif ( ARRAY_N === $output ) {
|
||||||
return array_values( get_object_vars( $_bookmark ) );
|
return array_values( get_object_vars( $_bookmark ) );
|
||||||
} else {
|
} else {
|
||||||
return $_bookmark;
|
return $_bookmark;
|
||||||
|
|
|
@ -218,11 +218,11 @@ function get_comment( $comment = null, $output = OBJECT ) {
|
||||||
*/
|
*/
|
||||||
$_comment = apply_filters( 'get_comment', $_comment );
|
$_comment = apply_filters( 'get_comment', $_comment );
|
||||||
|
|
||||||
if ( OBJECT == $output ) {
|
if ( OBJECT === $output ) {
|
||||||
return $_comment;
|
return $_comment;
|
||||||
} elseif ( ARRAY_A == $output ) {
|
} elseif ( ARRAY_A === $output ) {
|
||||||
return $_comment->to_array();
|
return $_comment->to_array();
|
||||||
} elseif ( ARRAY_N == $output ) {
|
} elseif ( ARRAY_N === $output ) {
|
||||||
return array_values( $_comment->to_array() );
|
return array_values( $_comment->to_array() );
|
||||||
}
|
}
|
||||||
return $_comment;
|
return $_comment;
|
||||||
|
|
|
@ -758,14 +758,16 @@ function wp_get_nav_menu_items( $menu, $args = array() ) {
|
||||||
$items = array_filter( $items, '_is_valid_nav_menu_item' );
|
$items = array_filter( $items, '_is_valid_nav_menu_item' );
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( ARRAY_A == $args['output'] ) {
|
if ( ARRAY_A === $args['output'] ) {
|
||||||
$items = wp_list_sort(
|
$items = wp_list_sort(
|
||||||
$items,
|
$items,
|
||||||
array(
|
array(
|
||||||
$args['output_key'] => 'ASC',
|
$args['output_key'] => 'ASC',
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
$i = 1;
|
$i = 1;
|
||||||
|
|
||||||
foreach ( $items as $k => $item ) {
|
foreach ( $items as $k => $item ) {
|
||||||
$items[ $k ]->{$args['output_key']} = $i++;
|
$items[ $k ]->{$args['output_key']} = $i++;
|
||||||
}
|
}
|
||||||
|
|
|
@ -677,15 +677,15 @@ function get_children( $args = '', $output = OBJECT ) {
|
||||||
$kids[ $child->ID ] = $children[ $key ];
|
$kids[ $child->ID ] = $children[ $key ];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( OBJECT == $output ) {
|
if ( OBJECT === $output ) {
|
||||||
return $kids;
|
return $kids;
|
||||||
} elseif ( ARRAY_A == $output ) {
|
} elseif ( ARRAY_A === $output ) {
|
||||||
$weeuns = array();
|
$weeuns = array();
|
||||||
foreach ( (array) $kids as $kid ) {
|
foreach ( (array) $kids as $kid ) {
|
||||||
$weeuns[ $kid->ID ] = get_object_vars( $kids[ $kid->ID ] );
|
$weeuns[ $kid->ID ] = get_object_vars( $kids[ $kid->ID ] );
|
||||||
}
|
}
|
||||||
return $weeuns;
|
return $weeuns;
|
||||||
} elseif ( ARRAY_N == $output ) {
|
} elseif ( ARRAY_N === $output ) {
|
||||||
$babes = array();
|
$babes = array();
|
||||||
foreach ( (array) $kids as $kid ) {
|
foreach ( (array) $kids as $kid ) {
|
||||||
$babes[ $kid->ID ] = array_values( get_object_vars( $kids[ $kid->ID ] ) );
|
$babes[ $kid->ID ] = array_values( get_object_vars( $kids[ $kid->ID ] ) );
|
||||||
|
@ -788,9 +788,9 @@ function get_post( $post = null, $output = OBJECT, $filter = 'raw' ) {
|
||||||
|
|
||||||
$_post = $_post->filter( $filter );
|
$_post = $_post->filter( $filter );
|
||||||
|
|
||||||
if ( ARRAY_A == $output ) {
|
if ( ARRAY_A === $output ) {
|
||||||
return $_post->to_array();
|
return $_post->to_array();
|
||||||
} elseif ( ARRAY_N == $output ) {
|
} elseif ( ARRAY_N === $output ) {
|
||||||
return array_values( $_post->to_array() );
|
return array_values( $_post->to_array() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3692,7 +3692,7 @@ function wp_get_recent_posts( $args = array(), $output = ARRAY_A ) {
|
||||||
$results = get_posts( $parsed_args );
|
$results = get_posts( $parsed_args );
|
||||||
|
|
||||||
// Backward compatibility. Prior to 3.1 expected posts to be returned in array.
|
// Backward compatibility. Prior to 3.1 expected posts to be returned in array.
|
||||||
if ( ARRAY_A == $output ) {
|
if ( ARRAY_A === $output ) {
|
||||||
foreach ( $results as $key => $result ) {
|
foreach ( $results as $key => $result ) {
|
||||||
$results[ $key ] = get_object_vars( $result );
|
$results[ $key ] = get_object_vars( $result );
|
||||||
}
|
}
|
||||||
|
|
|
@ -371,12 +371,12 @@ function wp_get_post_revision( &$post, $output = OBJECT, $filter = 'raw' ) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( OBJECT == $output ) {
|
if ( OBJECT === $output ) {
|
||||||
return $revision;
|
return $revision;
|
||||||
} elseif ( ARRAY_A == $output ) {
|
} elseif ( ARRAY_A === $output ) {
|
||||||
$_revision = get_object_vars( $revision );
|
$_revision = get_object_vars( $revision );
|
||||||
return $_revision;
|
return $_revision;
|
||||||
} elseif ( ARRAY_N == $output ) {
|
} elseif ( ARRAY_N === $output ) {
|
||||||
$_revision = array_values( get_object_vars( $revision ) );
|
$_revision = array_values( get_object_vars( $revision ) );
|
||||||
return $_revision;
|
return $_revision;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.8-alpha-50557';
|
$wp_version = '5.8-alpha-50558';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue