From 1431a7a39f2984cf85a76c8bb38e1071c50f3583 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 15 Sep 2019 10:35:03 +0000 Subject: [PATCH] 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. git-svn-id: https://develop.svn.wordpress.org/trunk@46124 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-dependency.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/class-wp-dependency.php b/src/wp-includes/class-wp-dependency.php index fc8099d5b9..12a3b94634 100644 --- a/src/wp-includes/class-wp-dependency.php +++ b/src/wp-includes/class-wp-dependency.php @@ -87,9 +87,11 @@ class _WP_Dependency { * Setup dependencies. * * @since 2.6.0 + * + * @param ...$args Dependency information. */ - public function __construct() { - list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args(); + public function __construct( ...$args ) { + list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = $args; if ( ! is_array( $this->deps ) ) { $this->deps = array(); }