Make WordPress Core

Changeset 53376


Ignore:
Timestamp:
05/10/2022 11:19:51 AM (2 years ago)
Author:
SergeyBiryukov
Message:

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.

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

Legend:

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

    r53299 r53376  
    918918        $where = implode( ' AND ', $this->sql_clauses['where'] );
    919919
    920         $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
     920        $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
    921921
    922922        /**
     
    928928         * @param WP_Comment_Query $query   Current instance of WP_Comment_Query (passed by reference).
    929929         */
    930         $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $clauses ), &$this ) );
     930        $clauses = apply_filters_ref_array( 'comments_clauses', array( compact( $pieces ), &$this ) );
    931931
    932932        $fields  = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
  • trunk/src/wp-includes/class-wp-network-query.php

    r53273 r53376  
    439439        $groupby = '';
    440440
    441         $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
     441        $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
    442442
    443443        /**
     
    449449         * @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( $clauses ), &$this ) );
     451        $clauses = apply_filters_ref_array( 'networks_clauses', array( compact( $pieces ), &$this ) );
    452452
    453453        $fields  = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
  • trunk/src/wp-includes/class-wp-site-query.php

    r53274 r53376  
    647647        $where = implode( ' AND ', $this->sql_clauses['where'] );
    648648
    649         $clauses = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
     649        $pieces = array( 'fields', 'join', 'where', 'orderby', 'limits', 'groupby' );
    650650
    651651        /**
     
    657657         * @param WP_Site_Query $query   Current instance of WP_Site_Query (passed by reference).
    658658         */
    659         $clauses = apply_filters_ref_array( 'sites_clauses', array( compact( $clauses ), &$this ) );
     659        $clauses = apply_filters_ref_array( 'sites_clauses', array( compact( $pieces ), &$this ) );
    660660
    661661        $fields  = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
  • trunk/src/wp-includes/class-wp-term-query.php

    r53309 r53376  
    701701        $where = implode( ' AND ', $this->sql_clauses['where'] );
    702702
    703         $clauses = array( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' );
     703        $pieces = array( 'fields', 'join', 'where', 'distinct', 'orderby', 'order', 'limits' );
    704704
    705705        /**
     
    722722         * @param array    $args       An array of term query arguments.
    723723         */
    724         $clauses = apply_filters( 'terms_clauses', compact( $clauses ), $taxonomies, $args );
     724        $clauses = apply_filters( 'terms_clauses', compact( $pieces ), $taxonomies, $args );
    725725
    726726        $fields   = isset( $clauses['fields'] ) ? $clauses['fields'] : '';
Note: See TracChangeset for help on using the changeset viewer.