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.
Built from https://develop.svn.wordpress.org/trunk@46130


git-svn-id: http://core.svn.wordpress.org/trunk@45942 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-09-15 11:11:56 +00:00
parent efe18c3604
commit 7093392099
2 changed files with 2 additions and 3 deletions

View File

@ -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 = '<p class="widget-loading hide-if-no-js">' . __( 'Loading&hellip;' ) . '</p><div class="hide-if-js notice notice-error inline"><p>' . __( 'This widget requires JavaScript.' ) . '</p></div>';
$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 );

View File

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