Make WordPress Core


Ignore:
Timestamp:
05/16/2020 06:40:52 PM (7 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-includes/class-wp-theme.php

    r47794 r47808  
    341341                        $parent_dir  = dirname( $this->stylesheet );
    342342                        $directories = search_theme_directories();
    343                         if ( '.' != $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) {
     343
     344                        if ( '.' !== $parent_dir && file_exists( $this->theme_root . '/' . $parent_dir . '/' . $this->template . '/index.php' ) ) {
    344345                                $this->template = $parent_dir . '/' . $this->template;
    345346                        } elseif ( $directories && isset( $directories[ $this->template ] ) ) {
    … …  
    11431144                $screenshot = $this->cache_get( 'screenshot' );
    11441145                if ( $screenshot ) {
    1145                         if ( 'relative' == $uri ) {
     1146                        if ( 'relative' === $uri ) {
    11461147                                return $screenshot;
    11471148                        }
    … …  
    11541155                        if ( file_exists( $this->get_stylesheet_directory() . "/screenshot.$ext" ) ) {
    11551156                                $this->cache_add( 'screenshot', 'screenshot.' . $ext );
    1156                                 if ( 'relative' == $uri ) {
     1157                                if ( 'relative' === $uri ) {
    11571158                                        return 'screenshot.' . $ext;
    11581159                                }
    … …  
    13201321
    13211322                $relative_path = trailingslashit( $relative_path );
    1322                 if ( '/' == $relative_path ) {
     1323                if ( '/' === $relative_path ) {
    13231324                        $relative_path = '';
    13241325                }
    … …  
    13371338
    13381339                foreach ( $results as $result ) {
    1339                         if ( '.' == $result[0] || in_array( $result, $exclusions, true ) ) {
     1340                        if ( '.' === $result[0] || in_array( $result, $exclusions, true ) ) {
    13401341                                continue;
    13411342                        }
    … …  
    14081409                }
    14091410
    1410                 if ( 'both' == $check || 'network' == $check ) {
     1411                if ( 'both' === $check || 'network' === $check ) {
    14111412                        $allowed = self::get_allowed_on_network();
    14121413                        if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) {
    … …  
    14151416                }
    14161417
    1417                 if ( 'both' == $check || 'site' == $check ) {
     1418                if ( 'both' === $check || 'site' === $check ) {
    14181419                        $allowed = self::get_allowed_on_site( $blog_id );
    14191420                        if ( ! empty( $allowed[ $this->get_stylesheet() ] ) ) {
Note: See TracChangeset for help on using the changeset viewer.