WordPress.org

Make WordPress Core

Changeset 48204


Ignore:
Timestamp:
06/28/2020 06:23:39 PM (15 months ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Introduce the spread operator in wp-includes/IXR.

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 kraftbj.
See #48267, #47678.

Location:
trunk/src/wp-includes/IXR
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/IXR/class-IXR-client.php

    r42201 r48204  
    5959    }
    6060
    61     function query()
     61    /**
     62     * @since 1.5.0
     63     * @since 5.5.0 Formalized the existing `...$args` parameter by adding it
     64     *              to the function signature.
     65     */
     66    function query( ...$args )
    6267    {
    63         $args = func_get_args();
    6468        $method = array_shift($args);
    6569        $request = new IXR_Request($method, $args);
  • trunk/src/wp-includes/IXR/class-IXR-clientmulticall.php

    r42201 r48204  
    2626    }
    2727
    28     function addCall()
     28    /**
     29     * @since 1.5.0
     30     * @since 5.5.0 Formalized the existing `...$args` parameter by adding it
     31     *              to the function signature.
     32     */
     33    function addCall( ...$args )
    2934    {
    30         $args = func_get_args();
    3135        $methodName = array_shift($args);
    3236        $struct = array(
     
    3741    }
    3842
    39     function query()
     43    /**
     44     * @since 1.5.0
     45     * @since 5.5.0 Formalized the existing `...$args` parameter by adding it
     46     *              to the function signature.
     47     */
     48    function query( ...$args )
    4049    {
    4150        // Prepare multicall, then call the parent::query() method
Note: See TracChangeset for help on using the changeset viewer.