From 2a35b3e7df72286543d35bd8b421c3b854793980 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 15 Sep 2019 11:50:55 +0000 Subject: [PATCH] Code Modernisation: Replace `call_user_func_array()` in `wp-includes/class-wp-walker.php` with dynamic function calls. Props jrf. See #47678. Built from https://develop.svn.wordpress.org/trunk@46143 git-svn-id: http://core.svn.wordpress.org/trunk@45955 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/class-wp-walker.php | 12 ++++-------- wp-includes/version.php | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/wp-includes/class-wp-walker.php b/wp-includes/class-wp-walker.php index 6799d42f28..50d63b6a99 100644 --- a/wp-includes/class-wp-walker.php +++ b/wp-includes/class-wp-walker.php @@ -141,8 +141,7 @@ class Walker { $args[0]['has_children'] = $this->has_children; // Back-compat. } - $cb_args = array_merge( array( &$output, $element, $depth ), $args ); - call_user_func_array( array( $this, 'start_el' ), $cb_args ); + $this->start_el( $output, $element, $depth, ...array_values( $args ) ); // descend only when the depth is right and there are childrens for this element if ( ( $max_depth == 0 || $max_depth > $depth + 1 ) && isset( $children_elements[ $id ] ) ) { @@ -152,8 +151,7 @@ class Walker { if ( ! isset( $newlevel ) ) { $newlevel = true; //start the child delimiter - $cb_args = array_merge( array( &$output, $depth ), $args ); - call_user_func_array( array( $this, 'start_lvl' ), $cb_args ); + $this->start_lvl( $output, $depth, ...array_values( $args ) ); } $this->display_element( $child, $children_elements, $max_depth, $depth + 1, $args, $output ); } @@ -162,13 +160,11 @@ class Walker { if ( isset( $newlevel ) && $newlevel ) { //end the child delimiter - $cb_args = array_merge( array( &$output, $depth ), $args ); - call_user_func_array( array( $this, 'end_lvl' ), $cb_args ); + $this->end_lvl( $output, $depth, ...array_values( $args ) ); } //end this element - $cb_args = array_merge( array( &$output, $element, $depth ), $args ); - call_user_func_array( array( $this, 'end_el' ), $cb_args ); + $this->end_el( $output, $element, $depth, ...array_values( $args ) ); } /** diff --git a/wp-includes/version.php b/wp-includes/version.php index d716eb6850..da5280f7a5 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.3-alpha-46142'; +$wp_version = '5.3-alpha-46143'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.