From 752c36bbf4967609b0959ca73a69c0e7b4904f80 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 15 Sep 2019 11:10:17 +0000 Subject: [PATCH] Code Modernisation: Introduce the spread operator in `wp-admin/includes/dashboard.php`. 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@46130 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/dashboard.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/wp-admin/includes/dashboard.php b/src/wp-admin/includes/dashboard.php index 3b687879ea..7598df80c8 100644 --- a/src/wp-admin/includes/dashboard.php +++ b/src/wp-admin/includes/dashboard.php @@ -1062,7 +1062,7 @@ function wp_dashboard_rss_output( $widget_id ) { * @param mixed ...$args Optional additional parameters to pass to the callback function when it's called. * @return bool False on failure. True on success. */ -function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) { +function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) { $loading = '

' . __( 'Loading…' ) . '

' . __( 'This widget requires JavaScript.' ) . '

'; $doing_ajax = wp_doing_ajax(); @@ -1089,7 +1089,6 @@ function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = ar } if ( $callback && is_callable( $callback ) ) { - $args = array_slice( func_get_args(), 3 ); array_unshift( $args, $widget_id, $check_urls ); ob_start(); call_user_func_array( $callback, $args );