Skip to content

Commit

Permalink
Coding Standards: Remove a one-time $pieces variable in `wp-include…
Browse files Browse the repository at this point in the history
…s/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
  • Loading branch information
SergeyBiryukov committed Mar 21, 2022
1 parent 38dbd50 commit 41de513
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
9 changes: 5 additions & 4 deletions wp-includes/class-wp-comment-query.php
Expand Up @@ -917,16 +917,17 @@ protected function get_comment_ids() {

$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'] : '';
Expand Down
8 changes: 4 additions & 4 deletions wp-includes/class-wp-network-query.php
Expand Up @@ -438,17 +438,17 @@ protected function get_network_ids() {

$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'] : '';
Expand Down
8 changes: 4 additions & 4 deletions wp-includes/class-wp-query.php
Expand Up @@ -2741,7 +2741,7 @@ public function get_posts() {
}
}

$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
Expand Down Expand Up @@ -2843,7 +2843,7 @@ public function get_posts() {
* }
* @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'] : '';
Expand Down Expand Up @@ -2964,7 +2964,7 @@ public function get_posts() {
*
* @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.
Expand All @@ -2977,7 +2977,7 @@ public function get_posts() {
* }
* @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'] : '';
Expand Down
8 changes: 4 additions & 4 deletions wp-includes/class-wp-site-query.php
Expand Up @@ -641,17 +641,17 @@ protected function get_site_ids() {

$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'] : '';
Expand Down
6 changes: 3 additions & 3 deletions wp-includes/class-wp-term-query.php
Expand Up @@ -692,18 +692,18 @@ public function get_terms() {

$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'] : '';
Expand Down
2 changes: 1 addition & 1 deletion wp-includes/version.php
Expand Up @@ -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.
Expand Down

0 comments on commit 41de513

Please sign in to comment.