WordPress.org

Make WordPress Core

Changeset 46126


Ignore:
Timestamp:
09/15/2019 10:44:58 AM (3 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r46109 r46126  
    10411041 * @return string New URL query string (unescaped).
    10421042 */
    1043 function add_query_arg() {
    1044     $args = func_get_args();
     1043function add_query_arg( ...$args ) {
    10451044    if ( is_array( $args[0] ) ) {
    10461045        if ( count( $args ) < 2 || false === $args[1] ) {
Note: See TracChangeset for help on using the changeset viewer.