Make WordPress Core


Ignore:
Timestamp:
09/09/2021 02:31:13 PM (3 years ago)
Author:
hellofromTonya
Message:

Code Modernization: Fix parameter name mismatches for parent/child classes in WP_Customize_Setting::sanitize().

In each child class: renames the parameter to match the parent's method signature.

Why? PHP 8 introduces the ability to pass named arguments to function/method calls. This means the child and parent method signatures (i.e. parameter names) need to match.

Changes for readability:

  • @since clearly specifies the original parameter name and its new name as well as why the change happened.
  • In methods longer than a single line, the generic parameter is reassigned to the original parameter restoring it for context for use within the method. An inline comment is added to explain why this reassignment is made.

Follow-up to [19995], [32806].

Props jrf, hellofromTonya, sergeybiryukov, azaozz, desrosj, johnbillion.
See #51553.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-nav-menu-setting.php

    r49108 r51783  
    408408     * @since 4.3.0
    409409     *
    410      * @param array $value The value to sanitize.
     410     * @param array $value The menu value to sanitize.
    411411     * @return array|false|null Null if an input isn't valid. False if it is marked for deletion.
    412412     *                          Otherwise the sanitized value.
Note: See TracChangeset for help on using the changeset viewer.