Coding Standards: Replace alias PHP functions with the canonical names.

Using the canonical function name for PHP functions is strongly recommended, as aliases may be deprecated or removed without (much) warning.

This replaces all uses of the following:
* `join()` with `implode()`
* `sizeof()` with `count()`
* `is_writeable()` with `is_writable()`
* `doubleval()` with a `(float)` cast

In part, this is a follow-up to #47746.

Props jrf.
See #50767.

git-svn-id: https://develop.svn.wordpress.org/trunk@49193 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-10-18 17:25:10 +00:00
parent f124a650ba
commit 97b2f07d2e
61 changed files with 115 additions and 115 deletions

View File

@@ -467,7 +467,7 @@ function size_format( $bytes, $decimals = 0 ) {
}
foreach ( $quant as $unit => $mag ) {
if ( doubleval( $bytes ) >= $mag ) {
if ( (float) $bytes >= $mag ) {
return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
}
}
@@ -3431,7 +3431,7 @@ function _default_wp_die_handler( $message, $title = '', $args = array() ) {
array( $message ),
wp_list_pluck( $parsed_args['additional_errors'], 'message' )
);
$message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
$message = "<ul>\n\t\t<li>" . implode( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
}
$message = sprintf(
@@ -5880,7 +5880,7 @@ function wp_timezone_choice( $selected_zone, $locale = null ) {
}
// Build the value.
$value = join( '/', $value );
$value = implode( '/', $value );
$selected = '';
if ( $value === $selected_zone ) {
$selected = 'selected="selected" ';
@@ -5981,7 +5981,7 @@ function wp_timezone_choice( $selected_zone, $locale = null ) {
}
$structure[] = '</optgroup>';
return join( "\n", $structure );
return implode( "\n", $structure );
}
/**
@@ -6419,7 +6419,7 @@ function wp_debug_backtrace_summary( $ignore_class = null, $skip_frames = 0, $pr
}
}
if ( $pretty ) {
return join( ', ', array_reverse( $caller ) );
return implode( ', ', array_reverse( $caller ) );
} else {
return $caller;
}