Code Modernisation: Use the spread operator in wp_register_sidebar_widget().

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.

Missed in [45629].

Props jrf.
See #47678.

git-svn-id: https://develop.svn.wordpress.org/trunk@46122 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2019-09-15 10:30:16 +00:00
parent 355cdce6b7
commit 812033f092

View File

@ -354,7 +354,7 @@ function is_registered_sidebar( $sidebar_id ) {
* }
* @param mixed ...$params Optional additional parameters to pass to the callback function when it's called.
*/
function wp_register_sidebar_widget( $id, $name, $output_callback, $options = array() ) {
function wp_register_sidebar_widget( $id, $name, $output_callback, $options = array(), ...$params ) {
global $wp_registered_widgets, $wp_registered_widget_controls, $wp_registered_widget_updates, $_wp_deprecated_widgets_callbacks;
$id = strtolower( $id );
@ -377,7 +377,7 @@ function wp_register_sidebar_widget( $id, $name, $output_callback, $options = ar
'name' => $name,
'id' => $id,
'callback' => $output_callback,
'params' => array_slice( func_get_args(), 4 ),
'params' => $params,
);
$widget = array_merge( $widget, $options );