Make WordPress Core

Changeset 45627


Ignore:
Timestamp:
07/12/2019 12:04:57 AM (6 years ago)
Author:
pento
Message:

Code Modernisation: Introduce the spread operator in walk_page_dropdown_tree().

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/post-template.php

    r45590 r45627  
    15481548 * @return string
    15491549 */
    1550 function walk_page_dropdown_tree() {
    1551     $args = func_get_args();
     1550function walk_page_dropdown_tree( ...$args ) {
    15521551    if ( empty( $args[2]['walker'] ) ) { // the user's options are the third parameter
    15531552        $walker = new Walker_PageDropdown;
     
    15561555    }
    15571556
    1558     return call_user_func_array( array( $walker, 'walk' ), $args );
     1557    return $walker->walk( ...$args );
    15591558}
    15601559
Note: See TracChangeset for help on using the changeset viewer.