Make WordPress Core


Ignore:
Timestamp:
09/15/2019 10:41:03 AM (7 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-wp-upgrader-skin.php

    r44964 r46125  
    141141        /**
    142142         * @param string $string
    143          */
    144         public function feedback( $string ) {
     143         * @param mixed  ...$args Optional text replacements.
     144         */
     145        public function feedback( $string, ...$args ) {
    145146                if ( isset( $this->upgrader->strings[ $string ] ) ) {
    146147                        $string = $this->upgrader->strings[ $string ];
    … …  
    148149
    149150                if ( strpos( $string, '%' ) !== false ) {
    150                         $args = func_get_args();
    151                         $args = array_splice( $args, 1 );
    152151                        if ( $args ) {
    153152                                $args   = array_map( 'strip_tags', $args );
Note: See TracChangeset for help on using the changeset viewer.