Make WordPress Core


Ignore:
Timestamp:
10/18/2020 05:25:10 PM (4 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/functions.php

    r49144 r49193  
    468468
    469469    foreach ( $quant as $unit => $mag ) {
    470         if ( doubleval( $bytes ) >= $mag ) {
     470        if ( (float) $bytes >= $mag ) {
    471471            return number_format_i18n( $bytes / $mag, $decimals ) . ' ' . $unit;
    472472        }
     
    34323432                wp_list_pluck( $parsed_args['additional_errors'], 'message' )
    34333433            );
    3434             $message = "<ul>\n\t\t<li>" . join( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
     3434            $message = "<ul>\n\t\t<li>" . implode( "</li>\n\t\t<li>", $message ) . "</li>\n\t</ul>";
    34353435        }
    34363436
     
    58815881
    58825882        // Build the value.
    5883         $value    = join( '/', $value );
     5883        $value    = implode( '/', $value );
    58845884        $selected = '';
    58855885        if ( $value === $selected_zone ) {
     
    59825982    $structure[] = '</optgroup>';
    59835983
    5984     return join( "\n", $structure );
     5984    return implode( "\n", $structure );
    59855985}
    59865986
     
    64206420    }
    64216421    if ( $pretty ) {
    6422         return join( ', ', array_reverse( $caller ) );
     6422        return implode( ', ', array_reverse( $caller ) );
    64236423    } else {
    64246424        return $caller;
Note: See TracChangeset for help on using the changeset viewer.