Skip to content

Commit d5b7d49

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@52998 602fd350-edb4-49c9-b593-d223f7449a82
1 parent b917c41 commit d5b7d49

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/wp-admin/includes/class-theme-upgrader.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -616,28 +616,28 @@ public function check_package( $source ) {
616616
*
617617
* @since 2.8.0
618618
*
619-
* @param bool|WP_Error $return Upgrade offer return.
620-
* @param array $theme Theme arguments.
621-
* @return bool|WP_Error The passed in $return param or WP_Error.
619+
* @param bool|WP_Error $response The installation response before the installation has started.
620+
* @param array $theme Theme arguments.
621+
* @return bool|WP_Error The original `$response` parameter or WP_Error.
622622
*/
623-
public function current_before( $return, $theme ) {
624-
if ( is_wp_error( $return ) ) {
625-
return $return;
623+
public function current_before( $response, $theme ) {
624+
if ( is_wp_error( $response ) ) {
625+
return $response;
626626
}
627627

628628
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
629629

630-
// Only run if active theme
630+
// Only run if active theme.
631631
if ( get_stylesheet() !== $theme ) {
632-
return $return;
632+
return $response;
633633
}
634634

635635
// Change to maintenance mode. Bulk edit handles this separately.
636636
if ( ! $this->bulk ) {
637637
$this->maintenance_mode( true );
638638
}
639639

640-
return $return;
640+
return $response;
641641
}
642642

643643
/**
@@ -648,20 +648,20 @@ public function current_before( $return, $theme ) {
648648
*
649649
* @since 2.8.0
650650
*
651-
* @param bool|WP_Error $return Upgrade offer return.
652-
* @param array $theme Theme arguments.
653-
* @return bool|WP_Error The passed in $return param or WP_Error.
651+
* @param bool|WP_Error $response The installation response after the installation has finished.
652+
* @param array $theme Theme arguments.
653+
* @return bool|WP_Error The original `$response` parameter or WP_Error.
654654
*/
655-
public function current_after( $return, $theme ) {
656-
if ( is_wp_error( $return ) ) {
657-
return $return;
655+
public function current_after( $response, $theme ) {
656+
if ( is_wp_error( $response ) ) {
657+
return $response;
658658
}
659659

660660
$theme = isset( $theme['theme'] ) ? $theme['theme'] : '';
661661

662662
// Only run if active theme.
663663
if ( get_stylesheet() !== $theme ) {
664-
return $return;
664+
return $response;
665665
}
666666

667667
// Ensure stylesheet name hasn't changed after the upgrade:
@@ -675,7 +675,7 @@ public function current_after( $return, $theme ) {
675675
if ( ! $this->bulk ) {
676676
$this->maintenance_mode( false );
677677
}
678-
return $return;
678+
return $response;
679679
}
680680

681681
/**

0 commit comments

Comments
 (0)