wp/wp-admin/includes/class-bulk-upgrader-skin.php
changeset 19 3d72ae0968f4
parent 16 a86126ab1dd4
child 21 48c4eec2b7e6
--- a/wp/wp-admin/includes/class-bulk-upgrader-skin.php	Wed Sep 21 18:19:35 2022 +0200
+++ b/wp/wp-admin/includes/class-bulk-upgrader-skin.php	Tue Sep 27 16:37:53 2022 +0200
@@ -49,28 +49,30 @@
 	}
 
 	/**
-	 * @param string $string
-	 * @param mixed  ...$args Optional text replacements.
+	 * @since 5.9.0 Renamed `$string` (a PHP reserved keyword) to `$feedback` for PHP 8 named parameter support.
+	 *
+	 * @param string $feedback Message data.
+	 * @param mixed  ...$args  Optional text replacements.
 	 */
-	public function feedback( $string, ...$args ) {
-		if ( isset( $this->upgrader->strings[ $string ] ) ) {
-			$string = $this->upgrader->strings[ $string ];
+	public function feedback( $feedback, ...$args ) {
+		if ( isset( $this->upgrader->strings[ $feedback ] ) ) {
+			$feedback = $this->upgrader->strings[ $feedback ];
 		}
 
-		if ( strpos( $string, '%' ) !== false ) {
+		if ( strpos( $feedback, '%' ) !== false ) {
 			if ( $args ) {
-				$args   = array_map( 'strip_tags', $args );
-				$args   = array_map( 'esc_html', $args );
-				$string = vsprintf( $string, $args );
+				$args     = array_map( 'strip_tags', $args );
+				$args     = array_map( 'esc_html', $args );
+				$feedback = vsprintf( $feedback, $args );
 			}
 		}
-		if ( empty( $string ) ) {
+		if ( empty( $feedback ) ) {
 			return;
 		}
 		if ( $this->in_loop ) {
-			echo "$string<br />\n";
+			echo "$feedback<br />\n";
 		} else {
-			echo "<p>$string</p>\n";
+			echo "<p>$feedback</p>\n";
 		}
 	}
 
@@ -87,18 +89,20 @@
 	}
 
 	/**
-	 * @param string|WP_Error $error
+	 * @since 5.9.0 Renamed `$error` to `$errors` for PHP 8 named parameter support.
+	 *
+	 * @param string|WP_Error $errors Errors.
 	 */
-	public function error( $error ) {
-		if ( is_string( $error ) && isset( $this->upgrader->strings[ $error ] ) ) {
-			$this->error = $this->upgrader->strings[ $error ];
+	public function error( $errors ) {
+		if ( is_string( $errors ) && isset( $this->upgrader->strings[ $errors ] ) ) {
+			$this->error = $this->upgrader->strings[ $errors ];
 		}
 
-		if ( is_wp_error( $error ) ) {
+		if ( is_wp_error( $errors ) ) {
 			$messages = array();
-			foreach ( $error->get_error_messages() as $emessage ) {
-				if ( $error->get_error_data() && is_string( $error->get_error_data() ) ) {
-					$messages[] = $emessage . ' ' . esc_html( strip_tags( $error->get_error_data() ) );
+			foreach ( $errors->get_error_messages() as $emessage ) {
+				if ( $errors->get_error_data() && is_string( $errors->get_error_data() ) ) {
+					$messages[] = $emessage . ' ' . esc_html( strip_tags( $errors->get_error_data() ) );
 				} else {
 					$messages[] = $emessage;
 				}