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.

Built from https://develop.svn.wordpress.org/trunk@45627


git-svn-id: http://core.svn.wordpress.org/trunk@45438 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Gary Pendergast 2019-07-12 00:06:55 +00:00
parent 02c07f23d5
commit 1af80c2106
2 changed files with 3 additions and 4 deletions

View File

@ -1547,15 +1547,14 @@ function walk_page_tree( $pages, $depth, $current_page, $r ) {
* *
* @return string * @return string
*/ */
function walk_page_dropdown_tree() { function walk_page_dropdown_tree( ...$args ) {
$args = func_get_args();
if ( empty( $args[2]['walker'] ) ) { // the user's options are the third parameter if ( empty( $args[2]['walker'] ) ) { // the user's options are the third parameter
$walker = new Walker_PageDropdown; $walker = new Walker_PageDropdown;
} else { } else {
$walker = $args[2]['walker']; $walker = $args[2]['walker'];
} }
return call_user_func_array( array( $walker, 'walk' ), $args ); return $walker->walk( ...$args );
} }
// //

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.3-alpha-45626'; $wp_version = '5.3-alpha-45627';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.