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.
Built from https://develop.svn.wordpress.org/trunk@53257


git-svn-id: http://core.svn.wordpress.org/trunk@52846 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-04-25 13:29:09 +00:00
parent 8f93e5f2dd
commit 5097c83eac
2 changed files with 9 additions and 9 deletions

View File

@ -238,13 +238,13 @@ final class WP_Customize_Widgets {
*
* @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 @@ final class WP_Customize_Widgets {
*
* @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;
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-beta2-53256';
$wp_version = '6.0-beta2-53257';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.