Make WordPress Core


Ignore:
Timestamp:
04/25/2022 01:27:44 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Rename parameters that use reserved keywords in wp-includes/class-wp-customize-widgets.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 $default parameter to $default_value in WP_Customize_Widgets class methods.

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].

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

File:
1 edited

Legend:

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

    r52978 r53257  
    239239     * @since 3.9.0
    240240     *
    241      * @param string $name    Post value.
    242      * @param mixed  $default Default post value.
     241     * @param string $name          Post value.
     242     * @param mixed  $default_value Default post value.
    243243     * @return mixed Unslashed post value or default value.
    244244     */
    245     protected function get_post_value( $name, $default = null ) {
     245    protected function get_post_value( $name, $default_value = null ) {
    246246        if ( ! isset( $_POST[ $name ] ) ) {
    247             return $default;
     247            return $default_value;
    248248        }
    249249
     
    20582058     * @since 4.2.0
    20592059     *
    2060      * @param string $option_name Option name.
    2061      * @param mixed  $default    Optional. Default value to return if the option does not exist. Default false.
     2060     * @param string $option_name   Option name.
     2061     * @param mixed  $default_value Optional. Default value to return if the option does not exist. Default false.
    20622062     * @return mixed Value set for the option.
    20632063     */
    2064     protected function get_captured_option( $option_name, $default = false ) {
     2064    protected function get_captured_option( $option_name, $default_value = false ) {
    20652065        if ( array_key_exists( $option_name, $this->_captured_options ) ) {
    20662066            $value = $this->_captured_options[ $option_name ];
    20672067        } else {
    2068             $value = $default;
     2068            $value = $default_value;
    20692069        }
    20702070        return $value;
Note: See TracChangeset for help on using the changeset viewer.