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.
Built from https://develop.svn.wordpress.org/trunk@46124


git-svn-id: http://core.svn.wordpress.org/trunk@45936 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-09-15 10:36:56 +00:00
parent 654f8a8677
commit 300b14e1ca
2 changed files with 5 additions and 3 deletions

View File

@ -87,9 +87,11 @@ class _WP_Dependency {
* Setup dependencies. * Setup dependencies.
* *
* @since 2.6.0 * @since 2.6.0
*
* @param ...$args Dependency information.
*/ */
public function __construct() { public function __construct( ...$args ) {
list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args(); list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = $args;
if ( ! is_array( $this->deps ) ) { if ( ! is_array( $this->deps ) ) {
$this->deps = array(); $this->deps = array();
} }

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-46123'; $wp_version = '5.3-alpha-46124';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.