mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-02 11:21:57 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@48204 git-svn-id: http://core.svn.wordpress.org/trunk@47973 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
3a6eeef571
commit
66591d00ab
@ -58,9 +58,13 @@ class IXR_Client
|
||||
self::__construct( $server, $path, $port, $timeout );
|
||||
}
|
||||
|
||||
function query()
|
||||
/**
|
||||
* @since 1.5.0
|
||||
* @since 5.5.0 Formalized the existing `...$args` parameter by adding it
|
||||
* to the function signature.
|
||||
*/
|
||||
function query( ...$args )
|
||||
{
|
||||
$args = func_get_args();
|
||||
$method = array_shift($args);
|
||||
$request = new IXR_Request($method, $args);
|
||||
$length = $request->getLength();
|
||||
|
@ -25,9 +25,13 @@ class IXR_ClientMulticall extends IXR_Client
|
||||
self::__construct( $server, $path, $port );
|
||||
}
|
||||
|
||||
function addCall()
|
||||
/**
|
||||
* @since 1.5.0
|
||||
* @since 5.5.0 Formalized the existing `...$args` parameter by adding it
|
||||
* to the function signature.
|
||||
*/
|
||||
function addCall( ...$args )
|
||||
{
|
||||
$args = func_get_args();
|
||||
$methodName = array_shift($args);
|
||||
$struct = array(
|
||||
'methodName' => $methodName,
|
||||
@ -36,7 +40,12 @@ class IXR_ClientMulticall extends IXR_Client
|
||||
$this->calls[] = $struct;
|
||||
}
|
||||
|
||||
function query()
|
||||
/**
|
||||
* @since 1.5.0
|
||||
* @since 5.5.0 Formalized the existing `...$args` parameter by adding it
|
||||
* to the function signature.
|
||||
*/
|
||||
function query( ...$args )
|
||||
{
|
||||
// Prepare multicall, then call the parent::query() method
|
||||
return parent::query('system.multicall', $this->calls);
|
||||
|
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.5-alpha-48203';
|
||||
$wp_version = '5.5-alpha-48204';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user