From cb2d81f6dff94bca6c2e76c40f1e609b6ffbaa45 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 10 May 2022 11:21:09 +0000 Subject: [PATCH] Coding Standards: Restore the `$pieces` variable for SQL clauses in query classes. This is a defensive coding measure that aims to reduce confusion. With this change, `$pieces` is explicitly used for the names, and `$clauses` for the values of the clauses. Follow-up to [52974], [53175], [53370], [53375]. Props peterwilsoncc. See #55699. Built from https://develop.svn.wordpress.org/trunk@53376 git-svn-id: http://core.svn.wordpress.org/trunk@52965 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-comment-query.php | 4 ++-- wp-includes/class-wp-network-query.php | 4 ++-- wp-includes/class-wp-site-query.php | 4 ++-- wp-includes/class-wp-term-query.php | 4 ++-- wp-includes/version.php | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/wp-includes/class-wp-comment-query.php b/wp-includes/class-wp-comment-query.php index f9f1c1ca1e..dede872bb7 100644 --- a/wp-includes/class-wp-comment-query.php +++ b/wp-includes/class-wp-comment-query.php @@ -917,7 +917,7 @@ class WP_Comment_Query { $where = implode( ' AND ', $this->sql_clauses['where'] ); - $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); + $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); /** * Filters the comment query clauses. @@ -927,7 +927,7 @@ class WP_Comment_Query { * @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( $clauses ), &$this ) ); + $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$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 5a132a2ee9..bf6323d747 100644 --- a/wp-includes/class-wp-network-query.php +++ b/wp-includes/class-wp-network-query.php @@ -438,7 +438,7 @@ class WP_Network_Query { $groupby = ''; - $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); + $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); /** * Filters the network query clauses. @@ -448,7 +448,7 @@ class WP_Network_Query { * @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( $clauses ), &$this ) ); + $clauses = apply_filters_ref_array( 'networks_clauses', array( compact( $pieces ), &$this ) ); $fields = isset( $clauses['fields'] ) ? $clauses['fields'] : ''; $join = isset( $clauses['join'] ) ? $clauses['join'] : ''; diff --git a/wp-includes/class-wp-site-query.php b/wp-includes/class-wp-site-query.php index c97a0f1748..76c38babd5 100644 --- a/wp-includes/class-wp-site-query.php +++ b/wp-includes/class-wp-site-query.php @@ -646,7 +646,7 @@ class WP_Site_Query { $where = implode( ' AND ', $this->sql_clauses['where'] ); - $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); + $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' ); /** * Filters the site query clauses. @@ -656,7 +656,7 @@ class WP_Site_Query { * @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( $clauses ), &$this ) ); + $clauses = apply_filters_ref_array( 'sites_clauses', array( compact( $pieces ), &$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 8ff0028ecf..5f35a9db68 100644 --- a/wp-includes/class-wp-term-query.php +++ b/wp-includes/class-wp-term-query.php @@ -700,7 +700,7 @@ class WP_Term_Query { $where = implode( ' AND ', $this->sql_clauses['where'] ); - $clauses = array( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' ); + $pieces = array( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' ); /** * Filters the terms query SQL clauses. @@ -721,7 +721,7 @@ class WP_Term_Query { * @param string[] $taxonomies An array of taxonomy names. * @param array $args An array of term query arguments. */ - $clauses = apply_filters( 'terms_clauses', compact( $clauses ), $taxonomies, $args ); + $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $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 c2f2d4caba..d2b45a0365 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.1-alpha-53375'; +$wp_version = '6.1-alpha-53376'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.