Make WordPress Core

Changeset 48238


Ignore:
Timestamp:
06/30/2020 07:48:48 PM (6 years ago)
Author:
SergeyBiryukov
Message:

Code Modernization: Introduce the spread operator in WP_HTTP_IXR_Client.

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.

This makes the signature of WP_HTTP_IXR_Client::query() compatible with the parent class method.

Follow-up to [48204].

Props ayeshrajans.
See #48267, #47678.

Location:
trunk/src/wp-includes
Files:
3 edited

Legend:

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

    r48204 r48238  
    6363         * @since 5.5.0 Formalized the existing `...$args` parameter by adding it
    6464         *              to the function signature.
     65         *
     66         * @return bool
    6567         */
    6668    function query( ...$args )
  • trunk/src/wp-includes/IXR/class-IXR-clientmulticall.php

    r48204 r48238  
    4545         * @since 5.5.0 Formalized the existing `...$args` parameter by adding it
    4646         *              to the function signature.
     47         *
     48         * @return bool
    4749         */
    4850    function query( ...$args )
  • trunk/src/wp-includes/class-wp-http-ixr-client.php

    r47219 r48238  
    4747
    4848        /**
     49         * @since 3.1.0
     50         * @since 5.5.0 Formalized the existing `...$args` parameter by adding it
     51         *              to the function signature.
     52         *
    4953         * @return bool
    5054         */
    51         public function query() {
    52                 $args    = func_get_args();
     55        public function query( ...$args ) {
    5356                $method  = array_shift( $args );
    5457                $request = new IXR_Request( $method, $args );
Note: See TracChangeset for help on using the changeset viewer.