Make WordPress Core


Ignore:
Timestamp:
05/16/2020 06:40:52 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison where static strings are involved.

This reduces the number of WordPress.PHP.StrictComparisons.LooseComparison issues in half, from 1897 to 890.

Includes minor code layout fixes for better readability.

See #49542.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/update-core.php

    r47771 r47808  
    10421042        if ( is_array( $checksums ) ) {
    10431043            foreach ( $checksums as $file => $checksum ) {
    1044                 if ( 'wp-content' == substr( $file, 0, 10 ) ) {
     1044                if ( 'wp-content' === substr( $file, 0, 10 ) ) {
    10451045                    continue;
    10461046                }
     
    11151115    if ( isset( $checksums ) && is_array( $checksums ) ) {
    11161116        foreach ( $checksums as $file => $checksum ) {
    1117             if ( 'wp-content' == substr( $file, 0, 10 ) ) {
     1117            if ( 'wp-content' === substr( $file, 0, 10 ) ) {
    11181118                continue;
    11191119            }
     
    11881188
    11891189    // 3.5 -> 3.5+ - an empty twentytwelve directory was created upon upgrade to 3.5 for some users, preventing installation of Twenty Twelve.
    1190     if ( '3.5' == $old_wp_version ) {
     1190    if ( '3.5' === $old_wp_version ) {
    11911191        if ( is_dir( WP_CONTENT_DIR . '/themes/twentytwelve' ) && ! file_exists( WP_CONTENT_DIR . '/themes/twentytwelve/style.css' ) ) {
    11921192            $wp_filesystem->delete( $wp_filesystem->wp_themes_dir() . 'twentytwelve/' );
     
    12041204            // If a $development_build or if $introduced version is greater than what the site was previously running.
    12051205            if ( $development_build || version_compare( $introduced_version, $old_wp_version, '>' ) ) {
    1206                 $directory             = ( '/' == $file[ strlen( $file ) - 1 ] );
    1207                 list($type, $filename) = explode( '/', $file, 2 );
     1206                $directory = ( '/' === $file[ strlen( $file ) - 1 ] );
     1207
     1208                list( $type, $filename ) = explode( '/', $file, 2 );
    12081209
    12091210                // Check to see if the bundled items exist before attempting to copy them.
     
    12121213                }
    12131214
    1214                 if ( 'plugins' == $type ) {
     1215                if ( 'plugins' === $type ) {
    12151216                    $dest = $wp_filesystem->wp_plugins_dir();
    1216                 } elseif ( 'themes' == $type ) {
     1217                } elseif ( 'themes' === $type ) {
    12171218                    // Back-compat, ::wp_themes_dir() did not return trailingslash'd pre-3.2.
    12181219                    $dest = trailingslashit( $wp_filesystem->wp_themes_dir() );
     
    13441345        }
    13451346
    1346         if ( 'f' == $fileinfo['type'] ) {
     1347        if ( 'f' === $fileinfo['type'] ) {
    13471348            if ( ! $wp_filesystem->copy( $from . $filename, $to . $filename, true, FS_CHMOD_FILE ) ) {
    13481349                // If copy failed, chmod file to 0644 and try again.
     
    13521353                }
    13531354            }
    1354         } elseif ( 'd' == $fileinfo['type'] ) {
     1355        } elseif ( 'd' === $fileinfo['type'] ) {
    13551356            if ( ! $wp_filesystem->is_dir( $to . $filename ) ) {
    13561357                if ( ! $wp_filesystem->mkdir( $to . $filename, FS_CHMOD_DIR ) ) {
     
    14001401
    14011402    // Ensure we only run this on the update-core.php page. The Core_Upgrader may be used in other contexts.
    1402     if ( 'update-core.php' != $pagenow ) {
     1403    if ( 'update-core.php' !== $pagenow ) {
    14031404        return;
    14041405    }
    14051406
    1406     if ( 'do-core-upgrade' != $action && 'do-core-reinstall' != $action ) {
     1407    if ( 'do-core-upgrade' !== $action && 'do-core-reinstall' !== $action ) {
    14071408        return;
    14081409    }
Note: See TracChangeset for help on using the changeset viewer.