Make WordPress Core


Ignore:
Timestamp:
09/15/2019 10:41:03 AM (5 years ago)
Author:
SergeyBiryukov
Message:

Code Modernisation: Introduce the spread operator in wp-admin/includes/class-*-upgrader-skin.php.

Rather than relying func_get_args() to retrieve arbitrary function arguments, we can now use the spread operator to assign them directly to a variable.

Props jrf.
See #47678.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-automatic-upgrader-skin.php

    r43571 r46125  
    5959    /**
    6060     * @param string|array|WP_Error $data
     61     * @param mixed                 ...$args Optional text replacements.
    6162     */
    62     public function feedback( $data ) {
     63    public function feedback( $data, ...$args ) {
    6364        if ( is_wp_error( $data ) ) {
    6465            $string = $data->get_error_message();
     
    7374
    7475        if ( strpos( $string, '%' ) !== false ) {
    75             $args = func_get_args();
    76             $args = array_splice( $args, 1 );
    7776            if ( ! empty( $args ) ) {
    7877                $string = vsprintf( $string, $args );
Note: See TracChangeset for help on using the changeset viewer.