From 8ca3012db972fadc85481a534cd8423b59f5ea61 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 24 Apr 2022 00:28:08 +0000 Subject: [PATCH] Code Modernization: Rename parameters that use reserved keywords in `swp-includes/class-wp-customize-setting.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_Setting` 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]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #55327. Built from https://develop.svn.wordpress.org/trunk@53246 git-svn-id: http://core.svn.wordpress.org/trunk@52835 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-customize-setting.php | 28 +++++++++++----------- wp-includes/version.php | 2 +- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/wp-includes/class-wp-customize-setting.php b/wp-includes/class-wp-customize-setting.php index 5d7ee228f1..e7a1030c76 100644 --- a/wp-includes/class-wp-customize-setting.php +++ b/wp-includes/class-wp-customize-setting.php @@ -547,11 +547,11 @@ class WP_Customize_Setting { * * @since 3.4.0 * - * @param mixed $default A default value which is used as a fallback. Default null. + * @param mixed $default_value A default value which is used as a fallback. Default null. * @return mixed The default value on failure, otherwise the sanitized and validated value. */ - final public function post_value( $default = null ) { - return $this->manager->post_value( $this, $default ); + final public function post_value( $default_value = null ) { + return $this->manager->post_value( $this, $default_value ); } /** @@ -621,22 +621,22 @@ class WP_Customize_Setting { * * @since 4.4.0 * - * @param mixed $default Value to return if root does not exist. + * @param mixed $default_value Value to return if root does not exist. * @return mixed */ - protected function get_root_value( $default = null ) { + protected function get_root_value( $default_value = null ) { $id_base = $this->id_data['base']; if ( 'option' === $this->type ) { - return get_option( $id_base, $default ); + return get_option( $id_base, $default_value ); } elseif ( 'theme_mod' === $this->type ) { - return get_theme_mod( $id_base, $default ); + return get_theme_mod( $id_base, $default_value ); } else { /* * Any WP_Customize_Setting subclass implementing aggregate multidimensional * will need to override this method to obtain the data from the appropriate * location. */ - return $default; + return $default_value; } } @@ -761,8 +761,8 @@ class WP_Customize_Setting { * @since 3.4.0 * @since 4.6.0 Added the `$this` setting instance as the second parameter. * - * @param mixed $default The setting default value. Default empty. - * @param WP_Customize_Setting $setting The setting instance. + * @param mixed $default_value The setting default value. Default empty. + * @param WP_Customize_Setting $setting The setting instance. */ $value = apply_filters( "customize_value_{$id_base}", $value, $this ); } elseif ( $this->is_multidimensional_aggregated ) { @@ -930,16 +930,16 @@ class WP_Customize_Setting { * * @param array $root * @param array $keys - * @param mixed $default A default value which is used as a fallback. Default null. + * @param mixed $default_value A default value which is used as a fallback. Default null. * @return mixed The requested value or the default value. */ - final protected function multidimensional_get( $root, $keys, $default = null ) { + final protected function multidimensional_get( $root, $keys, $default_value = null ) { if ( empty( $keys ) ) { // If there are no keys, test the root. - return isset( $root ) ? $root : $default; + return isset( $root ) ? $root : $default_value; } $result = $this->multidimensional( $root, $keys ); - return isset( $result ) ? $result['node'][ $result['key'] ] : $default; + return isset( $result ) ? $result['node'][ $result['key'] ] : $default_value; } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index 8476316ca3..57573b0e25 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -16,7 +16,7 @@ * * @global string $wp_version */ -$wp_version = '6.0-beta2-53245'; +$wp_version = '6.0-beta2-53246'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.