From 41de51364adb65f6ea305537c32038157f1986e6 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 21 Mar 2022 12:22:01 +0000 Subject: [PATCH] Coding Standards: Remove a one-time `$pieces` variable in `wp-includes/class-wp-*-query.php`. Use the existing `$clauses` variable instead for consistency. See #54728. Built from https://develop.svn.wordpress.org/trunk@52974 git-svn-id: http://core.svn.wordpress.org/trunk@52563 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-comment-query.php | 9 +++++---- wp-includes/class-wp-network-query.php | 8 ++++---- wp-includes/class-wp-query.php | 8 ++++---- wp-includes/class-wp-site-query.php | 8 ++++---- wp-includes/class-wp-term-query.php | 6 +++--- wp-includes/version.php | 2 +- 6 files changed, 21 insertions(+), 20 deletions(-) diff --git a/wp-includes/class-wp-comment-query.php b/wp-includes/class-wp-comment-query.php index 5fc8745e3a..5de26c1a66 100644 --- a/wp-includes/class-wp-comment-query.php +++ b/wp-includes/class-wp-comment-query.php @@ -917,16 +917,17 @@ class WP_Comment_Query { $where = implode( ' AND ', $this->sql_clauses['where'] ); - $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); + $clauses = compact( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); + /** * Filters the comment query clauses. * * @since 3.1.0 * - * @param string[] $pieces An associative array of comment query clauses. - * @param WP_Comment_Query $query Current instance of WP_Comment_Query (passed by reference). + * @param string[] $clauses An associative array of comment query clauses. + * @param WP_Comment_Query $query Current instance of WP_Comment_Query (passed by reference). */ - $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) ); + $clauses = apply_filters_ref_array( 'comments_clauses', array( $clauses, &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; diff --git a/wp-includes/class-wp-network-query.php b/wp-includes/class-wp-network-query.php index 41a3fe458d..cd8a029b14 100644 --- a/wp-includes/class-wp-network-query.php +++ b/wp-includes/class-wp-network-query.php @@ -438,17 +438,17 @@ class WP_Network_Query { $groupby = ''; - $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); + $clauses = compact( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); /** * Filters the network query clauses. * * @since 4.6.0 * - * @param string[] $pieces An associative array of network query clauses. - * @param WP_Network_Query $query Current instance of WP_Network_Query (passed by reference). + * @param string[] $clauses An associative array of network query clauses. + * @param WP_Network_Query $query Current instance of WP_Network_Query (passed by reference). */ - $clauses = apply_filters_ref_array( 'networks_clauses', array( compact( $pieces ), &$this ) ); + $clauses = apply_filters_ref_array( 'networks_clauses', array( $clauses, &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; diff --git a/wp-includes/class-wp-query.php b/wp-includes/class-wp-query.php index a2562519c4..7c53492547 100644 --- a/wp-includes/class-wp-query.php +++ b/wp-includes/class-wp-query.php @@ -2741,7 +2741,7 @@ class WP_Query { } } - $pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' ); + $clauses = compact( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' ); /* * Apply post-paging filters on where and join. Only plugins that @@ -2843,7 +2843,7 @@ class WP_Query { * } * @param WP_Query $query The WP_Query instance (passed by reference). */ - $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) ); + $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( $clauses, &$this ) ); $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; @@ -2964,7 +2964,7 @@ class WP_Query { * * @since 3.1.0 * - * @param string[] $pieces { + * @param string[] $clauses { * Associative array of the clauses for the query. * * @type string $where The WHERE clause of the query. @@ -2977,7 +2977,7 @@ class WP_Query { * } * @param WP_Query $query The WP_Query instance (passed by reference). */ - $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) ); + $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( $clauses, &$this ) ); $where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; diff --git a/wp-includes/class-wp-site-query.php b/wp-includes/class-wp-site-query.php index 24225665d4..b175906823 100644 --- a/wp-includes/class-wp-site-query.php +++ b/wp-includes/class-wp-site-query.php @@ -641,17 +641,17 @@ class WP_Site_Query { $where = implode( ' AND ', $this->sql_clauses['where'] ); - $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); + $clauses = compact( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); /** * Filters the site query clauses. * * @since 4.6.0 * - * @param string[] $pieces An associative array of site query clauses. - * @param WP_Site_Query $query Current instance of WP_Site_Query (passed by reference). + * @param string[] $clauses An associative array of site query clauses. + * @param WP_Site_Query $query Current instance of WP_Site_Query (passed by reference). */ - $clauses = apply_filters_ref_array( 'sites_clauses', array( compact( $pieces ), &$this ) ); + $clauses = apply_filters_ref_array( 'sites_clauses', array( $clauses, &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; diff --git a/wp-includes/class-wp-term-query.php b/wp-includes/class-wp-term-query.php index 2a52fcd602..816f80ef7b 100644 --- a/wp-includes/class-wp-term-query.php +++ b/wp-includes/class-wp-term-query.php @@ -692,18 +692,18 @@ class WP_Term_Query { $where = implode( ' AND ', $this->sql_clauses['where'] ); - $pieces = compact( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' ); + $clauses = compact( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' ); /** * Filters the terms query SQL clauses. * * @since 3.1.0 * - * @param string[] $pieces Array of query SQL clauses. + * @param string[] $clauses Array of query SQL clauses. * @param string[] $taxonomies An array of taxonomy names. * @param array $args An array of term query arguments. */ - $clauses = apply_filters( 'terms_clauses', $pieces, $taxonomies, $args ); + $clauses = apply_filters( 'terms_clauses', $clauses, $taxonomies, $args ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; diff --git a/wp-includes/version.php b/wp-includes/version.php index fe8c60b5a6..d51ef7dc3f 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-alpha-52973'; +$wp_version = '6.0-alpha-52974'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.