diff -r 3d4e9c994f10 -r a86126ab1dd4 wp/wp-admin/includes/class-wp-ajax-upgrader-skin.php --- a/wp/wp-admin/includes/class-wp-ajax-upgrader-skin.php Tue Oct 22 16:11:46 2019 +0200 +++ b/wp/wp-admin/includes/class-wp-ajax-upgrader-skin.php Tue Dec 15 13:49:49 2020 +0100 @@ -22,6 +22,7 @@ * Holds the WP_Error object. * * @since 4.6.0 + * * @var null|WP_Error */ protected $errors = null; @@ -29,9 +30,15 @@ /** * Constructor. * + * Sets up the WordPress Ajax upgrader skin. + * * @since 4.6.0 * - * @param array $args Options for the upgrader, see WP_Upgrader_Skin::__construct(). + * @see WP_Upgrader_Skin::__construct() + * + * @param array $args Optional. The WordPress Ajax upgrader skin arguments to + * override default options. See WP_Upgrader_Skin::__construct(). + * Default empty array. */ public function __construct( $args = array() ) { parent::__construct( $args ); @@ -77,10 +84,13 @@ * Stores a log entry for an error. * * @since 4.6.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. * - * @param string|WP_Error $errors Errors. + * @param string|WP_Error $errors Errors. + * @param mixed ...$args Optional text replacements. */ - public function error( $errors ) { + public function error( $errors, ...$args ) { if ( is_string( $errors ) ) { $string = $errors; if ( ! empty( $this->upgrader->strings[ $string ] ) ) { @@ -88,41 +98,40 @@ } if ( false !== strpos( $string, '%' ) ) { - $args = func_get_args(); - $args = array_splice( $args, 1 ); if ( ! empty( $args ) ) { $string = vsprintf( $string, $args ); } } - // Count existing errors to generate an unique error code. + // Count existing errors to generate a unique error code. $errors_count = count( $this->errors->get_error_codes() ); - $this->errors->add( 'unknown_upgrade_error_' . $errors_count + 1, $string ); + $this->errors->add( 'unknown_upgrade_error_' . ( $errors_count + 1 ), $string ); } elseif ( is_wp_error( $errors ) ) { foreach ( $errors->get_error_codes() as $error_code ) { $this->errors->add( $error_code, $errors->get_error_message( $error_code ), $errors->get_error_data( $error_code ) ); } } - $args = func_get_args(); - call_user_func_array( array( $this, 'parent::error' ), $args ); + parent::error( $errors, ...$args ); } /** * Stores a log entry. * * @since 4.6.0 + * @since 5.3.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. * - * @param string|array|WP_Error $data Log entry data. + * @param string|array|WP_Error $data Log entry data. + * @param mixed ...$args Optional text replacements. */ - public function feedback( $data ) { + public function feedback( $data, ...$args ) { if ( is_wp_error( $data ) ) { foreach ( $data->get_error_codes() as $error_code ) { $this->errors->add( $error_code, $data->get_error_message( $error_code ), $data->get_error_data( $error_code ) ); } } - $args = func_get_args(); - call_user_func_array( array( $this, 'parent::feedback' ), $args ); + parent::feedback( $data, ...$args ); } }