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
This commit is contained in:
parent
af246a6797
commit
516f528421
@ -1040,8 +1040,7 @@ function _http_build_query( $data, $prefix = null, $sep = null, $key = '', $urle
|
|||||||
* @param string $url Optional. A URL to act upon.
|
* @param string $url Optional. A URL to act upon.
|
||||||
* @return string New URL query string (unescaped).
|
* @return string New URL query string (unescaped).
|
||||||
*/
|
*/
|
||||||
function add_query_arg() {
|
function add_query_arg( ...$args ) {
|
||||||
$args = func_get_args();
|
|
||||||
if ( is_array( $args[0] ) ) {
|
if ( is_array( $args[0] ) ) {
|
||||||
if ( count( $args ) < 2 || false === $args[1] ) {
|
if ( count( $args ) < 2 || false === $args[1] ) {
|
||||||
$uri = $_SERVER['REQUEST_URI'];
|
$uri = $_SERVER['REQUEST_URI'];
|
||||||
|
Loading…
Reference in New Issue
Block a user