Code Modernization: Rename parameters that use reserved keywords in wp-admin/includes/class-wp-debug-data.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 `$var` parameter to `$mysql_var` in `WP_Debug_Data::get_mysql_var()`.

Additionally, `$type` is renamed to `$data_type` in `WP_Debug_Data::format()` for clarity.

Follow-up to [51522], [52946], [52996], [52997], [52998].

Props jrf, aristath, poena, justinahinon, SergeyBiryukov.
See #55327.
Built from https://develop.svn.wordpress.org/trunk@53003


git-svn-id: http://core.svn.wordpress.org/trunk@52592 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-03-28 13:24:01 +00:00
parent c3a76d012d
commit 8761c4cefd
2 changed files with 11 additions and 11 deletions

View File

@ -1471,20 +1471,20 @@ class WP_Debug_Data {
}
/**
* Returns the value of a MySQL variable.
* Returns the value of a MySQL system variable.
*
* @since 5.9.0
*
* @global wpdb $wpdb WordPress database abstraction object.
*
* @param string $var Name of the MySQL variable.
* @param string $mysql_var Name of the MySQL system variable.
* @return string|null The variable value on success. Null if the variable does not exist.
*/
public static function get_mysql_var( $var ) {
public static function get_mysql_var( $mysql_var ) {
global $wpdb;
$result = $wpdb->get_row(
$wpdb->prepare( 'SHOW VARIABLES LIKE %s', $var ),
$wpdb->prepare( 'SHOW VARIABLES LIKE %s', $mysql_var ),
ARRAY_A
);
@ -1500,11 +1500,11 @@ class WP_Debug_Data {
*
* @since 5.2.0
*
* @param array $info_array Information gathered from the `WP_Debug_Data::debug_data` function.
* @param string $type The data type to return, either 'info' or 'debug'.
* @param array $info_array Information gathered from the `WP_Debug_Data::debug_data()` function.
* @param string $data_type The data type to return, either 'info' or 'debug'.
* @return string The formatted data.
*/
public static function format( $info_array, $type ) {
public static function format( $info_array, $data_type ) {
$return = "`\n";
foreach ( $info_array as $section => $details ) {
@ -1513,7 +1513,7 @@ class WP_Debug_Data {
continue;
}
$section_label = 'debug' === $type ? $section : $details['label'];
$section_label = 'debug' === $data_type ? $section : $details['label'];
$return .= sprintf(
"### %s%s ###\n\n",
@ -1526,7 +1526,7 @@ class WP_Debug_Data {
continue;
}
if ( 'debug' === $type && isset( $field['debug'] ) ) {
if ( 'debug' === $data_type && isset( $field['debug'] ) ) {
$debug_data = $field['debug'];
} else {
$debug_data = $field['value'];
@ -1547,7 +1547,7 @@ class WP_Debug_Data {
$value = $debug_data;
}
if ( 'debug' === $type ) {
if ( 'debug' === $data_type ) {
$label = $field_name;
} else {
$label = $field['label'];

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.0-alpha-53002';
$wp_version = '6.0-alpha-53003';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.