WordPress.org

Make WordPress Core


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

    r45932 r46125  
    5151    /**
    5252     * @param string $string
     53     * @param mixed  ...$args Optional text replacements.
    5354     */
    54     public function feedback( $string ) {
     55    public function feedback( $string, ...$args ) {
    5556        if ( isset( $this->upgrader->strings[ $string ] ) ) {
    5657            $string = $this->upgrader->strings[ $string ];
     
    5859
    5960        if ( strpos( $string, '%' ) !== false ) {
    60             $args = func_get_args();
    61             $args = array_splice( $args, 1 );
    6261            if ( $args ) {
    6362                $args   = array_map( 'strip_tags', $args );
Note: See TracChangeset for help on using the changeset viewer.