Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/class-theme-upgrader.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 `$return` variable in `Theme_Upgrader` class methods to `$response` and updates the documentation accordingly. Follow-up to [47409], [52946], [52996], [52997]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #55327. Built from https://develop.svn.wordpress.org/trunk@52998 git-svn-id: http://core.svn.wordpress.org/trunk@52587 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
0cde19b503
commit
407a9bebe4
|
@ -616,20 +616,20 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
* @param bool|WP_Error $return Upgrade offer return.
|
* @param bool|WP_Error $response The installation response before the installation has started.
|
||||||
* @param array $theme Theme arguments.
|
* @param array $theme Theme arguments.
|
||||||
* @return bool|WP_Error The passed in $return param or WP_Error.
|
* @return bool|WP_Error The original `$response` parameter or WP_Error.
|
||||||
*/
|
*/
|
||||||
public function current_before( $return, $theme ) {
|
public function current_before( $response, $theme ) {
|
||||||
if ( is_wp_error( $return ) ) {
|
if ( is_wp_error( $response ) ) {
|
||||||
return $return;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
|
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
|
||||||
|
|
||||||
// Only run if active theme
|
// Only run if active theme.
|
||||||
if ( get_stylesheet() !== $theme ) {
|
if ( get_stylesheet() !== $theme ) {
|
||||||
return $return;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Change to maintenance mode. Bulk edit handles this separately.
|
// Change to maintenance mode. Bulk edit handles this separately.
|
||||||
|
@ -637,7 +637,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||||
$this->maintenance_mode( true );
|
$this->maintenance_mode( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
return $return;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -648,20 +648,20 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||||
*
|
*
|
||||||
* @since 2.8.0
|
* @since 2.8.0
|
||||||
*
|
*
|
||||||
* @param bool|WP_Error $return Upgrade offer return.
|
* @param bool|WP_Error $response The installation response after the installation has finished.
|
||||||
* @param array $theme Theme arguments.
|
* @param array $theme Theme arguments.
|
||||||
* @return bool|WP_Error The passed in $return param or WP_Error.
|
* @return bool|WP_Error The original `$response` parameter or WP_Error.
|
||||||
*/
|
*/
|
||||||
public function current_after( $return, $theme ) {
|
public function current_after( $response, $theme ) {
|
||||||
if ( is_wp_error( $return ) ) {
|
if ( is_wp_error( $response ) ) {
|
||||||
return $return;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
|
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
|
||||||
|
|
||||||
// Only run if active theme.
|
// Only run if active theme.
|
||||||
if ( get_stylesheet() !== $theme ) {
|
if ( get_stylesheet() !== $theme ) {
|
||||||
return $return;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Ensure stylesheet name hasn't changed after the upgrade:
|
// Ensure stylesheet name hasn't changed after the upgrade:
|
||||||
|
@ -675,7 +675,7 @@ class Theme_Upgrader extends WP_Upgrader {
|
||||||
if ( ! $this->bulk ) {
|
if ( ! $this->bulk ) {
|
||||||
$this->maintenance_mode( false );
|
$this->maintenance_mode( false );
|
||||||
}
|
}
|
||||||
return $return;
|
return $response;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.0-alpha-52997';
|
$wp_version = '6.0-alpha-52998';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue