Make WordPress Core

Changeset 53281


Ignore:
Timestamp:
04/26/2022 02:26:38 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in wp-includes/class-wp-query.php.

While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names.

This commit renames the $list parameter to $status in WP_Dependencies::query().

Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192], [53193], [53198], [53203], [53207], [53215], [53216], [53220], [53230], [53232], [53236], [53239], [53240], [53242], [53243], [53245], [53246], [53257], [53269], [53270], [53271], [53272], [53273], [53274], [53275], [53276], [53277].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.

File:
1 edited

Legend:

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

    r52339 r53281  
    432432
    433433    /**
    434      * Query list for an item.
     434     * Query the list for an item.
    435435     *
    436436     * @since 2.1.0
     
    438438     *
    439439     * @param string $handle Name of the item. Should be unique.
    440      * @param string $list   Optional. Property name of list array. Default 'registered'.
     440     * @param string $status Optional. Status of the item to query. Default 'registered'.
    441441     * @return bool|_WP_Dependency Found, or object Item data.
    442442     */
    443     public function query( $handle, $list = 'registered' ) {
    444         switch ( $list ) {
     443    public function query( $handle, $status = 'registered' ) {
     444        switch ( $status ) {
    445445            case 'registered':
    446446            case 'scripts': // Back compat.
     
    451451
    452452            case 'enqueued':
    453             case 'queue':
     453            case 'queue': // Back compat.
    454454                if ( in_array( $handle, $this->queue, true ) ) {
    455455                    return true;
     
    465465                return in_array( $handle, $this->done, true );
    466466        }
     467
    467468        return false;
    468469    }
Note: See TracChangeset for help on using the changeset viewer.