From f6b7a1fd7a84d68b82ec8d4c023895b19496d919 Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 17 Apr 2022 14:10:07 +0000 Subject: [PATCH] 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 --- wp-admin/includes/menu.php | 14 +++++++++----- wp-includes/version.php | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/wp-admin/includes/menu.php b/wp-admin/includes/menu.php index 7323443949..6cb474b38d 100644 --- a/wp-admin/includes/menu.php +++ b/wp-admin/includes/menu.php @@ -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 ); + \ No newline at end of file diff --git a/wp-includes/version.php b/wp-includes/version.php index 487d1112a7..491cd04fe4 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -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.