From e7b6a4dce88dd45be8a807b4e389b8b9c460503d Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Wed, 30 Jun 2021 17:44:58 +0000 Subject: [PATCH] Coding Standards: Remove redundant type casting to array in `WP_Query::get_posts()`. This brings some consistency with other instances of using `get_post_stati()` in core. `get_post_stati()` always returns an array, so the type casting is not needed. Follow-up to [13172]. See #53359. Built from https://develop.svn.wordpress.org/trunk@51285 git-svn-id: http://core.svn.wordpress.org/trunk@50894 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-query.php | 6 +++--- wp-includes/link-template.php | 2 +- wp-includes/version.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index 430e2767fa..bc1131ed5b 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -2547,7 +2547,7 @@ class WP_Query { // Public statuses. $public_statuses = get_post_stati( array( 'public' => true ) ); $status_clauses = array(); - foreach ( (array) $public_statuses as $public_status ) { + foreach ( $public_statuses as $public_status ) { $status_clauses[] = "{$wpdb->posts}.post_status = '$public_status'"; } $type_where .= implode( ' OR ', $status_clauses ); @@ -2560,7 +2560,7 @@ class WP_Query { 'show_in_admin_all_list' => true, ) ); - foreach ( (array) $admin_all_statuses as $admin_all_status ) { + foreach ( $admin_all_statuses as $admin_all_status ) { $type_where .= " OR {$wpdb->posts}.post_status = '$admin_all_status'"; } } @@ -2569,7 +2569,7 @@ class WP_Query { if ( is_user_logged_in() && $queried_post_type_object instanceof WP_Post_Type ) { $read_private_cap = $queried_post_type_object->cap->read_private_posts; $private_statuses = get_post_stati( array( 'private' => true ) ); - foreach ( (array) $private_statuses as $private_status ) { + foreach ( $private_statuses as $private_status ) { $type_where .= current_user_can( $read_private_cap ) ? " \nOR {$wpdb->posts}.post_status = '$private_status'" : " \nOR ({$wpdb->posts}.post_author = $user_id AND {$wpdb->posts}.post_status = '$private_status')"; } } diff --git a/wp-includes/link-template.php b/wp-includes/link-template.php index 0ff33466e8..d4b348593b 100644 --- a/wp-includes/link-template.php +++ b/wp-includes/link-template.php @@ -1872,7 +1872,7 @@ function get_adjacent_post( $in_same_term = false, $excluded_terms = '', $previo */ $private_states = get_post_stati( array( 'private' => true ) ); $where .= " AND ( p.post_status = 'publish'"; - foreach ( (array) $private_states as $state ) { + foreach ( $private_states as $state ) { if ( current_user_can( $read_private_cap ) ) { $where .= $wpdb->prepare( ' OR p.post_status = %s', $state ); } else { diff --git a/wp-includes/version.php b/wp-includes/version.php index f8728c24c8..57e9a58d03 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.9-alpha-51284'; +$wp_version = '5.9-alpha-51285'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.