From 6e829a7b2606a68107977835e85e6ab4cdc3f0ab Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Fri, 12 Jul 2019 00:04:57 +0000 Subject: [PATCH] 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 --- src/wp-includes/post-template.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/wp-includes/post-template.php b/src/wp-includes/post-template.php index db2bd4875f..b91b775554 100644 --- a/src/wp-includes/post-template.php +++ b/src/wp-includes/post-template.php @@ -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 ); } //