Make WordPress Core

Changeset 56326


Ignore:
Timestamp:
07/31/2023 01:31:28 PM (4 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp-includes/functions.php.

Follow-up to [5999], [6342], [7406], [8369], [10322], [11288], [11332], [11597], [12405], [13569], [14649], [15806], [19773], [26449], [26926], [39831], [40124].

Props aristath, poena, afercia, SergeyBiryukov.
See #58831.

File:
1 edited

Legend:

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

    r56211 r56326  
    10621062            $k = urlencode( $k );
    10631063        }
    1064         if ( is_int( $k ) && null != $prefix ) {
     1064
     1065        if ( is_int( $k ) && null !== $prefix ) {
    10651066            $k = $prefix . $k;
    10661067        }
     1068
    10671069        if ( ! empty( $key ) ) {
    10681070            $k = $key . '%5B' . $k . '%5D';
    10691071        }
     1072
    10701073        if ( null === $v ) {
    10711074            continue;
     
    17731776
    17741777    $suppress = $wpdb->suppress_errors();
     1778
    17751779    if ( ! wp_installing() ) {
    17761780        $alloptions = wp_load_alloptions();
    17771781    }
     1782
    17781783    // If siteurl is not set to autoload, check it specifically.
    17791784    if ( ! isset( $alloptions['siteurl'] ) ) {
     
    17821787        $installed = $alloptions['siteurl'];
    17831788    }
     1789
    17841790    $wpdb->suppress_errors( $suppress );
    17851791
     
    18061812    foreach ( $wp_tables as $table ) {
    18071813        // The existence of custom user tables shouldn't suggest an unwise state or prevent a clean installation.
    1808         if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE == $table ) {
     1814        if ( defined( 'CUSTOM_USER_TABLE' ) && CUSTOM_USER_TABLE === $table ) {
    18091815            continue;
    18101816        }
    1811         if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE == $table ) {
     1817
     1818        if ( defined( 'CUSTOM_USER_META_TABLE' ) && CUSTOM_USER_META_TABLE === $table ) {
    18121819            continue;
    18131820        }
     
    20812088         * the $dir_perms correctly with chmod()
    20822089         */
    2083         if ( ( $dir_perms & ~umask() ) != $dir_perms ) {
     2090        if ( ( $dir_perms & ~umask() ) !== $dir_perms ) {
    20842091            $folder_parts = explode( '/', substr( $target, strlen( $target_parent ) + 1 ) );
    20852092            for ( $i = 1, $c = count( $folder_parts ); $i <= $c; $i++ ) {
     
    24312438    $url = get_option( 'upload_url_path' );
    24322439    if ( ! $url ) {
    2433         if ( empty( $upload_path ) || ( 'wp-content/uploads' === $upload_path ) || ( $upload_path == $dir ) ) {
     2440        if ( empty( $upload_path ) || ( 'wp-content/uploads' === $upload_path ) || ( $upload_path === $dir ) ) {
    24342441            $url = WP_CONTENT_URL . '/uploads';
    24352442        } else {
     
    30963103        $real_mime = wp_get_image_mime( $file );
    30973104
    3098         if ( $real_mime && $real_mime != $type ) {
     3105        if ( $real_mime && $real_mime !== $type ) {
    30993106            /**
    31003107             * Filters the list mapping image mime types to their respective extensions.
     
    31233130                $new_filename     = implode( '.', $filename_parts );
    31243131
    3125                 if ( $new_filename != $filename ) {
     3132                if ( $new_filename !== $filename ) {
    31263133                    $proper_filename = $new_filename; // Mark that it changed.
    31273134                }
     3135
    31283136                // Redefine the extension / MIME.
    31293137                $wp_filetype = wp_check_filetype( $new_filename, $mimes );
     
    47884796
    47894797        // New subpattern?
    4790         if ( $firstchar != $subchar ) {
     4798        if ( $firstchar !== $subchar ) {
    47914799            if ( '' !== $subchar ) {
    47924800                $wp_smiliessearch .= ')(?=' . $spaces . '|$)';  // End previous "subpattern".
    47934801                $wp_smiliessearch .= '|(?<=' . $spaces . '|^)'; // Begin another "subpattern".
    47944802            }
     4803
    47954804            $subchar           = $firstchar;
    47964805            $wp_smiliessearch .= preg_quote( $firstchar, '/' ) . '(?:';
     
    47984807            $wp_smiliessearch .= '|';
    47994808        }
     4809
    48004810        $wp_smiliessearch .= preg_quote( $rest, '/' );
    48014811    }
     
    59395949    $server_parts[1] = isset( $server_parts[1] ) ? $server_parts[1] : '';
    59405950
    5941     return ( 'lighttpd' === $server_parts[0] && -1 == version_compare( $server_parts[1], '1.5.0' ) );
     5951    return ( 'lighttpd' === $server_parts[0] && -1 === version_compare( $server_parts[1], '1.5.0' ) );
    59425952}
    59435953
     
    63486358        return false;
    63496359    }
     6360
    63506361    return round( timezone_offset_get( $timezone_object, $datetime_object ) / HOUR_IN_SECONDS, 2 );
    63516362}
     
    63686379            return -1 * ( strnatcasecmp( $a['city'], $b['city'] ) );
    63696380        }
     6381
    63706382        if ( 'UTC' === $a['city'] ) {
    63716383            if ( str_starts_with( $b['city'], 'GMT+' ) ) {
    63726384                return 1;
    63736385            }
     6386
    63746387            return -1;
    63756388        }
     6389
    63766390        if ( 'UTC' === $b['city'] ) {
    63776391            if ( str_starts_with( $a['city'], 'GMT+' ) ) {
    63786392                return -1;
    63796393            }
     6394
    63806395            return 1;
    63816396        }
     6397
    63826398        return strnatcasecmp( $a['city'], $b['city'] );
    63836399    }
    6384     if ( $a['t_continent'] == $b['t_continent'] ) {
    6385         if ( $a['t_city'] == $b['t_city'] ) {
     6400
     6401    if ( $a['t_continent'] === $b['t_continent'] ) {
     6402        if ( $a['t_city'] === $b['t_city'] ) {
    63866403            return strnatcasecmp( $a['t_subcity'], $b['t_subcity'] );
    63876404        }
     6405
    63886406        return strnatcasecmp( $a['t_city'], $b['t_city'] );
    63896407    } else {
     
    63926410            return 1;
    63936411        }
     6412
    63946413        if ( 'Etc' === $b['continent'] ) {
    63956414            return -1;
    63966415        }
     6416
    63976417        return strnatcasecmp( $a['t_continent'], $b['t_continent'] );
    63986418    }
     
    69146934
    69156935        // Tortoise got lapped - must be a loop.
    6916         if ( $tortoise == $evanescent_hare || $tortoise == $hare ) {
     6936        if ( $tortoise === $evanescent_hare || $tortoise === $hare ) {
    69176937            return $_return_loop ? $return : $tortoise;
    69186938        }
     
    70117031            $skip_frames--;
    70127032        } elseif ( isset( $call['class'] ) ) {
    7013             if ( $check_class && $ignore_class == $call['class'] ) {
     7033            if ( $check_class && $ignore_class === $call['class'] ) {
    70147034                continue; // Filter out calls.
    70157035            }
Note: See TracChangeset for help on using the changeset viewer.