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. git-svn-id: https://develop.svn.wordpress.org/trunk@45627 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
03b7742ee9
commit
6e829a7b26
@ -1547,15 +1547,14 @@ function walk_page_tree( $pages, $depth, $current_page, $r ) {
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
function walk_page_dropdown_tree() {
|
||||
$args = func_get_args();
|
||||
function walk_page_dropdown_tree( ...$args ) {
|
||||
if ( empty( $args[2]['walker'] ) ) { // the user's options are the third parameter
|
||||
$walker = new Walker_PageDropdown;
|
||||
} else {
|
||||
$walker = $args[2]['walker'];
|
||||
}
|
||||
|
||||
return call_user_func_array( array( $walker, 'walk' ), $args );
|
||||
return $walker->walk( ...$args );
|
||||
}
|
||||
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user