Make WordPress Core

Changeset 52974


Ignore:
Timestamp:
03/21/2022 12:20:22 PM (2 years ago)
Author:
SergeyBiryukov
Message:

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.

Location:
trunk/src/wp-includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-comment-query.php

    r52973 r52974  
    918918        $where = implode( ' AND ', $this->sql_clauses['where'] );
    919919
    920         $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
     920        $clauses = compact( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
     921
    921922        /**
    922923         * Filters the comment query clauses.
     
    924925         * @since 3.1.0
    925926         *
    926          * @param string[]         $pieces An associative array of comment query clauses.
    927          * @param WP_Comment_Query $query  Current instance of WP_Comment_Query (passed by reference).
     927         * @param string[]         $clauses An associative array of comment query clauses.
     928         * @param WP_Comment_Query $query   Current instance of WP_Comment_Query (passed by reference).
    928929         */
    929         $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
     930        $clauses = apply_filters_ref_array( 'comments_clauses', array( $clauses, &$this ) );
    930931
    931932        $fields  = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
  • trunk/src/wp-includes/class-wp-network-query.php

    r52973 r52974  
    439439        $groupby = '';
    440440
    441         $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
     441        $clauses = compact( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
    442442
    443443        /**
     
    446446         * @since 4.6.0
    447447         *
    448          * @param string[]         $pieces An associative array of network query clauses.
    449          * @param WP_Network_Query $query  Current instance of WP_Network_Query (passed by reference).
     448         * @param string[]         $clauses An associative array of network query clauses.
     449         * @param WP_Network_Query $query   Current instance of WP_Network_Query (passed by reference).
    450450         */
    451         $clauses = apply_filters_ref_array( 'networks_clauses', array( compact( $pieces ), &$this ) );
     451        $clauses = apply_filters_ref_array( 'networks_clauses', array( $clauses, &$this ) );
    452452
    453453        $fields  = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
  • trunk/src/wp-includes/class-wp-query.php

    r52973 r52974  
    27422742        }
    27432743
    2744         $pieces = array( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
     2744        $clauses = compact( 'where', 'groupby', 'join', 'orderby', 'distinct', 'fields', 'limits' );
    27452745
    27462746        /*
     
    28442844             * @param WP_Query $query   The WP_Query instance (passed by reference).
    28452845             */
    2846             $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( compact( $pieces ), &$this ) );
     2846            $clauses = (array) apply_filters_ref_array( 'posts_clauses', array( $clauses, &$this ) );
    28472847
    28482848            $where    = isset( $clauses['where'] ) ? $clauses['where'] : '';
     
    29652965             * @since 3.1.0
    29662966             *
    2967              * @param string[] $pieces {
     2967             * @param string[] $clauses {
    29682968             *     Associative array of the clauses for the query.
    29692969             *
     
    29782978             * @param WP_Query $query  The WP_Query instance (passed by reference).
    29792979             */
    2980             $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( compact( $pieces ), &$this ) );
     2980            $clauses = (array) apply_filters_ref_array( 'posts_clauses_request', array( $clauses, &$this ) );
    29812981
    29822982            $where    = isset( $clauses['where'] ) ? $clauses['where'] : '';
  • trunk/src/wp-includes/class-wp-site-query.php

    r52973 r52974  
    642642        $where = implode( ' AND ', $this->sql_clauses['where'] );
    643643
    644         $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
     644        $clauses = compact( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
    645645
    646646        /**
     
    649649         * @since 4.6.0
    650650         *
    651          * @param string[]      $pieces An associative array of site query clauses.
    652          * @param WP_Site_Query $query  Current instance of WP_Site_Query (passed by reference).
     651         * @param string[]      $clauses An associative array of site query clauses.
     652         * @param WP_Site_Query $query   Current instance of WP_Site_Query (passed by reference).
    653653         */
    654         $clauses = apply_filters_ref_array( 'sites_clauses', array( compact( $pieces ), &$this ) );
     654        $clauses = apply_filters_ref_array( 'sites_clauses', array( $clauses, &$this ) );
    655655
    656656        $fields  = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
  • trunk/src/wp-includes/class-wp-term-query.php

    r52973 r52974  
    693693        $where = implode( ' AND ', $this->sql_clauses['where'] );
    694694
    695         $pieces = compact( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' );
     695        $clauses = compact( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' );
    696696
    697697        /**
     
    700700         * @since 3.1.0
    701701         *
    702          * @param string[] $pieces     Array of query SQL clauses.
     702         * @param string[] $clauses    Array of query SQL clauses.
    703703         * @param string[] $taxonomies An array of taxonomy names.
    704704         * @param array    $args       An array of term query arguments.
    705705         */
    706         $clauses = apply_filters( 'terms_clauses', $pieces, $taxonomies, $args );
     706        $clauses = apply_filters( 'terms_clauses', $clauses, $taxonomies, $args );
    707707
    708708        $fields   = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
Note: See TracChangeset for help on using the changeset viewer.