mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
Code Modernization: Rename parameters that use reserved keywords in wp-includes/functions.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 `$array` parameter to `$input_array` in `wp_recursive_ksort()`. * Moves the function next to other array-related functions for consistency. Follow-up to [53129], [54929]. Props jrf, aristath, poena, justinahinon, SergeyBiryukov. See #56788. git-svn-id: https://develop.svn.wordpress.org/trunk@55117 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
1e608be8c5
commit
005cfdbf4e
@ -4876,6 +4876,26 @@ function wp_array_slice_assoc( $input_array, $keys ) {
|
||||
return $slice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the keys of an array alphabetically.
|
||||
*
|
||||
* The array is passed by reference so it doesn't get returned
|
||||
* which mimics the behavior of `ksort()`.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $input_array The array to sort, passed by reference.
|
||||
*/
|
||||
function wp_recursive_ksort( &$input_array ) {
|
||||
foreach ( $input_array as &$value ) {
|
||||
if ( is_array( $value ) ) {
|
||||
wp_recursive_ksort( $value );
|
||||
}
|
||||
}
|
||||
|
||||
ksort( $input_array );
|
||||
}
|
||||
|
||||
/**
|
||||
* Accesses an array in depth based on a path of keys.
|
||||
*
|
||||
@ -8429,21 +8449,3 @@ function is_php_version_compatible( $required ) {
|
||||
function wp_fuzzy_number_match( $expected, $actual, $precision = 1 ) {
|
||||
return abs( (float) $expected - (float) $actual ) <= $precision;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sorts the keys of an array alphabetically.
|
||||
* The array is passed by reference so it doesn't get returned
|
||||
* which mimics the behavior of ksort.
|
||||
*
|
||||
* @since 6.0.0
|
||||
*
|
||||
* @param array $array The array to sort, passed by reference.
|
||||
*/
|
||||
function wp_recursive_ksort( &$array ) {
|
||||
foreach ( $array as &$value ) {
|
||||
if ( is_array( $value ) ) {
|
||||
wp_recursive_ksort( $value );
|
||||
}
|
||||
}
|
||||
ksort( $array );
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user