From 0378bddc1a0bf7ccdbc7a18a26fa4eb8e2736ec3 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Mon, 25 Apr 2022 13:27:44 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@53257 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-customize-widgets.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/wp-includes/class-wp-customize-widgets.php b/src/wp-includes/class-wp-customize-widgets.php index ff3b08a8c1340..9b4a0fa1c5edf 100644 --- a/src/wp-includes/class-wp-customize-widgets.php +++ b/src/wp-includes/class-wp-customize-widgets.php @@ -238,13 +238,13 @@ public function filter_customize_dynamic_setting_args( $args, $setting_id ) { * * @since 3.9.0 * - * @param string $name Post value. - * @param mixed $default Default post value. + * @param string $name Post value. + * @param mixed $default_value Default post value. * @return mixed Unslashed post value or default value. */ - protected function get_post_value( $name, $default = null ) { + protected function get_post_value( $name, $default_value = null ) { if ( ! isset( $_POST[ $name ] ) ) { - return $default; + return $default_value; } return wp_unslash( $_POST[ $name ] ); @@ -2057,15 +2057,15 @@ protected function get_captured_options() { * * @since 4.2.0 * - * @param string $option_name Option name. - * @param mixed $default Optional. Default value to return if the option does not exist. Default false. + * @param string $option_name Option name. + * @param mixed $default_value Optional. Default value to return if the option does not exist. Default false. * @return mixed Value set for the option. */ - protected function get_captured_option( $option_name, $default = false ) { + protected function get_captured_option( $option_name, $default_value = false ) { if ( array_key_exists( $option_name, $this->_captured_options ) ) { $value = $this->_captured_options[ $option_name ]; } else { - $value = $default; + $value = $default_value; } return $value; }