From a21b3b7d366ef00301a2a7d320170c048e20328a Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 30 Jun 2020 19:48:48 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@48238 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/IXR/class-IXR-client.php | 2 ++ src/wp-includes/IXR/class-IXR-clientmulticall.php | 2 ++ src/wp-includes/class-wp-http-ixr-client.php | 7 +++++-- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/IXR/class-IXR-client.php b/src/wp-includes/IXR/class-IXR-client.php index 480822316b..2072f7c9c2 100644 --- a/src/wp-includes/IXR/class-IXR-client.php +++ b/src/wp-includes/IXR/class-IXR-client.php @@ -62,6 +62,8 @@ class IXR_Client * @since 1.5.0 * @since 5.5.0 Formalized the existing `...$args` parameter by adding it * to the function signature. + * + * @return bool */ function query( ...$args ) { diff --git a/src/wp-includes/IXR/class-IXR-clientmulticall.php b/src/wp-includes/IXR/class-IXR-clientmulticall.php index 5a10246dbd..d7aa67b2d5 100644 --- a/src/wp-includes/IXR/class-IXR-clientmulticall.php +++ b/src/wp-includes/IXR/class-IXR-clientmulticall.php @@ -44,6 +44,8 @@ class IXR_ClientMulticall extends IXR_Client * @since 1.5.0 * @since 5.5.0 Formalized the existing `...$args` parameter by adding it * to the function signature. + * + * @return bool */ function query( ...$args ) { diff --git a/src/wp-includes/class-wp-http-ixr-client.php b/src/wp-includes/class-wp-http-ixr-client.php index f873e8f728..401bd97589 100644 --- a/src/wp-includes/class-wp-http-ixr-client.php +++ b/src/wp-includes/class-wp-http-ixr-client.php @@ -46,10 +46,13 @@ class WP_HTTP_IXR_Client extends IXR_Client { } /** + * @since 3.1.0 + * @since 5.5.0 Formalized the existing `...$args` parameter by adding it + * to the function signature. + * * @return bool */ - public function query() { - $args = func_get_args(); + public function query( ...$args ) { $method = array_shift( $args ); $request = new IXR_Request( $method, $args ); $xml = $request->getXml();