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
This commit is contained in:
parent
e5a17836c7
commit
1431a7a39f
@ -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();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user