Coding Standards: Restore the `$pieces` variable in `WP_Query::get_posts()`.

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].

Props peterwilsoncc.
See #55699.
Built from https://develop.svn.wordpress.org/trunk@53375


git-svn-id: http://core.svn.wordpress.org/trunk@52964 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-05-10 11:17:14 +00:00
parent 1dff8e7973
commit 4959a268c3
2 changed files with 5 additions and 7 deletions

View File

@ -2754,6 +2754,8 @@ class WP_Query {
} }
} }
$pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
/* /*
* Apply post-paging filters on where and join. Only plugins that * Apply post-paging filters on where and join. Only plugins that
* manipulate paging queries should use these hooks. * manipulate paging queries should use these hooks.
@ -2833,8 +2835,6 @@ class WP_Query {
*/ */
$fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) ); $fields = apply_filters_ref_array( 'posts_fields', array( $fields, &$this ) );
$clauses = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
/** /**
* Filters all query clauses at once, for convenience. * Filters all query clauses at once, for convenience.
* *
@ -2856,7 +2856,7 @@ class WP_Query {
* } * }
* @param WP_Query $query The WP_Query instance (passed by reference). * @param WP_Query $query The WP_Query instance (passed by reference).
*/ */
$clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $clauses ), &$this ) ); $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
$where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : '';
$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';
@ -2967,8 +2967,6 @@ class WP_Query {
*/ */
$limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) ); $limits = apply_filters_ref_array( 'post_limits_request', array( $limits, &$this ) );
$clauses = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
/** /**
* Filters all query clauses at once, for convenience. * Filters all query clauses at once, for convenience.
* *
@ -2992,7 +2990,7 @@ class WP_Query {
* } * }
* @param WP_Query $query The WP_Query instance (passed by reference). * @param WP_Query $query The WP_Query instance (passed by reference).
*/ */
$clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $clauses ), &$this ) ); $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
$where = isset( $clauses['where'] ) ? $clauses['where'] : ''; $where = isset( $clauses['where'] ) ? $clauses['where'] : '';
$groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : ''; $groupby = isset( $clauses['groupby'] ) ? $clauses['groupby'] : '';

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-alpha-53373'; $wp_version = '6.1-alpha-53375';
/** /**
* 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.