From 516f52842111b0a7b4783898286058f76a56616b Mon Sep 17 00:00:00 2001 From: Sergey Biryukov <sergeybiryukov@git.wordpress.org> Date: Sun, 15 Sep 2019 10:44:58 +0000 Subject: [PATCH] Code Modernisation: Introduce the spread operator in `wp-includes/functions.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@46126 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/functions.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-includes/functions.php b/src/wp-includes/functions.php index 0de1076f59..6961378e4e 100644 --- a/src/wp-includes/functions.php +++ b/src/wp-includes/functions.php @@ -1040,8 +1040,7 @@ function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urle * @param string $url Optional. A URL to act upon. * @return string New URL query string (unescaped). */ -function add_query_arg() { - $args = func_get_args(); +function add_query_arg( ...$args ) { if ( is_array( $args[0] ) ) { if ( count( $args ) < 2 || false === $args[1] ) { $uri = $_SERVER['REQUEST_URI'];