Skip to content

Commit

Permalink
Code Modernization: Rename parameters that use reserved keywords in `…
Browse files Browse the repository at this point in the history
…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
  • Loading branch information
SergeyBiryukov committed Apr 25, 2022
1 parent 8b488cb commit 0378bdd
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/wp-includes/class-wp-customize-widgets.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ] );
Expand Down Expand Up @@ -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;
}
Expand Down

0 comments on commit 0378bdd

Please sign in to comment.