Make WordPress Core


Ignore:
Timestamp:
09/05/2023 12:22:44 PM (14 months ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in wp-includes/functions.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 $class parameter to $class_name in _deprecated_class().

Follow-up to [54929], [56467].

Props jrf.
See #59161.

File:
1 edited

Legend:

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

    r56510 r56514  
    56265626 * @since 6.4.0
    56275627 *
    5628  * @param string $class       The class being instantiated.
     5628 * @param string $class_name  The name of the class being instantiated.
    56295629 * @param string $version     The version of WordPress that deprecated the class.
    56305630 * @param string $replacement Optional. The class or function that should have been called.
    56315631 *                            Default empty string.
    56325632 */
    5633 function _deprecated_class( $class, $version, $replacement = '' ) {
     5633function _deprecated_class( $class_name, $version, $replacement = '' ) {
    56345634
    56355635    /**
     
    56385638     * @since 6.4.0
    56395639     *
    5640      * @param string $class       The class being instantiated.
     5640     * @param string $class_name  The name of the class being instantiated.
    56415641     * @param string $replacement The class or function that should have been called.
    56425642     * @param string $version     The version of WordPress that deprecated the class.
    56435643     */
    5644     do_action( 'deprecated_class_run', $class, $replacement, $version );
     5644    do_action( 'deprecated_class_run', $class_name, $replacement, $version );
    56455645
    56465646    /**
     
    56585658                        /* translators: 1: PHP class name, 2: Version number, 3: Alternative class or function name. */
    56595659                        __( 'Class %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.' ),
    5660                         $class,
     5660                        $class_name,
    56615661                        $version,
    56625662                        $replacement
     
    56695669                        /* translators: 1: PHP class name, 2: Version number. */
    56705670                        __( 'Class %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.' ),
    5671                         $class,
     5671                        $class_name,
    56725672                        $version
    56735673                    ),
     
    56805680                    sprintf(
    56815681                        'Class %1$s is <strong>deprecated</strong> since version %2$s! Use %3$s instead.',
    5682                         $class,
     5682                        $class_name,
    56835683                        $version,
    56845684                        $replacement
     
    56905690                    sprintf(
    56915691                        'Class %1$s is <strong>deprecated</strong> since version %2$s with no alternative available.',
    5692                         $class,
     5692                        $class_name,
    56935693                        $version
    56945694                    ),
Note: See TracChangeset for help on using the changeset viewer.