WordPress.org

Make WordPress Core


Ignore:
Timestamp:
09/15/2019 11:10:17 AM (2 months ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/dashboard.php

    r45932 r46130  
    10631063 * @return bool False on failure. True on success.
    10641064 */
    1065 function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array() ) {
     1065function wp_dashboard_cached_rss_widget( $widget_id, $callback, $check_urls = array(), ...$args ) {
    10661066    $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>';
    10671067    $doing_ajax = wp_doing_ajax();
     
    10901090
    10911091    if ( $callback && is_callable( $callback ) ) {
    1092         $args = array_slice( func_get_args(), 3 );
    10931092        array_unshift( $args, $widget_id, $check_urls );
    10941093        ob_start();
Note: See TracChangeset for help on using the changeset viewer.