Code Modernization: Rename parameters that use reserved keywords in `wp-admin/includes/menu.php`.
While using reserved PHP keywords as parameter name labels is allowed, in the context of function calls using named parameters in PHP 8.0+, this will easily lead to confusion. To avoid that, it is recommended not to use reserved keywords as function parameter names. This commit: * Renames the `$class` parameter to `$classes` in `add_cssclass()`. * Renames the `$add` parameter to `$class_to_add` for clarity. * Includes minor code layout changes for better readability. Follow-up to [52946], [52996], [52997], [52998], [53003], [53014], [53029], [53039], [53116], [53117], [53137], [53174], [53184], [53185], [53192]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #55327. Built from https://develop.svn.wordpress.org/trunk@53193 git-svn-id: http://core.svn.wordpress.org/trunk@52782 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
88cce3c705
commit
f6b7a1fd7a
|
@ -187,13 +187,16 @@ foreach ( $menu as $id => $data ) {
|
|||
unset( $id, $data, $subs, $first_sub );
|
||||
|
||||
/**
|
||||
* @param string $add
|
||||
* @param string $class
|
||||
* @param string $class_to_add
|
||||
* @param string $classes
|
||||
* @return string
|
||||
*/
|
||||
function add_cssclass( $add, $class ) {
|
||||
$class = empty( $class ) ? $add : $class .= ' ' . $add;
|
||||
return $class;
|
||||
function add_cssclass( $class_to_add, $classes ) {
|
||||
if ( empty( $classes ) ) {
|
||||
return $class_to_add;
|
||||
}
|
||||
|
||||
return $classes . ' ' . $class_to_add;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -351,3 +354,4 @@ if ( ! user_can_access_admin_page() ) {
|
|||
}
|
||||
|
||||
$menu = add_menu_classes( $menu );
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.0-beta1-53192';
|
||||
$wp_version = '6.0-beta1-53193';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue