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-includes/class-wp-rewrite.php

    r47550 r47808  
    527527        $tok_index = 1;
    528528        foreach ( (array) $tokens[0] as $token ) {
    529             if ( '%post_id%' == $token && ( $tok_index <= 3 ) ) {
     529            if ( '%post_id%' === $token && ( $tok_index <= 3 ) ) {
    530530                $front = $front . 'date/';
    531531                break;
     
    12621262        // robots.txt -- only if installed at the root.
    12631263        $home_path      = parse_url( home_url() );
    1264         $robots_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array();
     1264        $robots_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'robots\.txt$' => $this->index . '?robots=1' ) : array();
    12651265
    12661266        // favicon.ico -- only if installed at the root.
    1267         $favicon_rewrite = ( empty( $home_path['path'] ) || '/' == $home_path['path'] ) ? array( 'favicon\.ico$' => $this->index . '?favicon=1' ) : array();
     1267        $favicon_rewrite = ( empty( $home_path['path'] ) || '/' === $home_path['path'] ) ? array( 'favicon\.ico$' => $this->index . '?favicon=1' ) : array();
    12681268
    12691269        // Old feed and service files.
     
    14051405             */
    14061406            $rules = apply_filters( "{$permastructname}_rewrite_rules", $rules );
    1407             if ( 'post_tag' == $permastructname ) {
     1407
     1408            if ( 'post_tag' === $permastructname ) {
    14081409
    14091410                /**
     
    16481649            $this->add_external_rule( $regex, $query );
    16491650        } else {
    1650             if ( 'bottom' == $after ) {
     1651            if ( 'bottom' === $after ) {
    16511652                $this->extra_rules = array_merge( $this->extra_rules, array( $regex => $query ) );
    16521653            } else {
     
    18551856        unset( $this->feed_structure );
    18561857        unset( $this->comment_feed_structure );
    1857         $this->use_trailing_slashes = ( '/' == substr( $this->permalink_structure, -1, 1 ) );
     1858
     1859        $this->use_trailing_slashes = ( '/' === substr( $this->permalink_structure, -1, 1 ) );
    18581860
    18591861        // Enable generic rules for pages if permalink structure doesn't begin with a wildcard.
Note: See TracChangeset for help on using the changeset viewer.