mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01:00
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. Built from https://develop.svn.wordpress.org/trunk@46122 git-svn-id: http://core.svn.wordpress.org/trunk@45934 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d46f9b4fb8
commit
7322d3f35e
@ -13,7 +13,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '5.3-alpha-46121';
|
||||
$wp_version = '5.3-alpha-46122';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
@ -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 );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user