WordPress.org

Make WordPress Core


Ignore:
Timestamp:
05/16/2020 06:40:52 PM (11 months 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-http-cookie.php

    r47617 r47808  
    100100        }
    101101        $this->path = isset( $arrURL['path'] ) ? $arrURL['path'] : '/';
    102         if ( '/' != substr( $this->path, -1 ) ) {
     102        if ( '/' !== substr( $this->path, -1 ) ) {
    103103            $this->path = dirname( $this->path ) . '/';
    104104        }
     
    128128                list( $key, $val ) = strpos( $pair, '=' ) ? explode( '=', $pair ) : array( $pair, '' );
    129129                $key               = strtolower( trim( $key ) );
    130                 if ( 'expires' == $key ) {
     130                if ( 'expires' === $key ) {
    131131                    $val = strtotime( $val );
    132132                }
     
    175175        // Get details on the URL we're thinking about sending to.
    176176        $url         = parse_url( $url );
    177         $url['port'] = isset( $url['port'] ) ? $url['port'] : ( 'https' == $url['scheme'] ? 443 : 80 );
     177        $url['port'] = isset( $url['port'] ) ? $url['port'] : ( 'https' === $url['scheme'] ? 443 : 80 );
    178178        $url['path'] = isset( $url['path'] ) ? $url['path'] : '/';
    179179
     
    187187
    188188        // Host - very basic check that the request URL ends with the domain restriction (minus leading dot).
    189         $domain = substr( $domain, 0, 1 ) == '.' ? substr( $domain, 1 ) : $domain;
     189        $domain = ( '.' === substr( $domain, 0, 1 ) ) ? substr( $domain, 1 ) : $domain;
    190190        if ( substr( $url['host'], -strlen( $domain ) ) != $domain ) {
    191191            return false;
Note: See TracChangeset for help on using the changeset viewer.