Make WordPress Core

Changeset 46124


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

Code Modernisation: Introduce the spread operator in wp-includes/class-wp-dependency.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-includes/class-wp-dependency.php

    r45611 r46124  
    8888     *
    8989     * @since 2.6.0
     90     *
     91     * @param ...$args Dependency information.
    9092     */
    91     public function __construct() {
    92         list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
     93    public function __construct( ...$args ) {
     94        list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = $args;
    9395        if ( ! is_array( $this->deps ) ) {
    9496            $this->deps = array();
Note: See TracChangeset for help on using the changeset viewer.