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-http.php

    r47617 r47808  
    217217
    218218        // By default, HEAD requests do not cause redirections.
    219         if ( isset( $args['method'] ) && 'HEAD' == $args['method'] ) {
     219        if ( isset( $args['method'] ) && 'HEAD' === $args['method'] ) {
    220220            $defaults['redirection'] = 0;
    221221        }
     
    740740                $newheaders[ $key ] = $value;
    741741            }
    742             if ( 'set-cookie' == $key ) {
     742            if ( 'set-cookie' === $key ) {
    743743                $cookies[] = new WP_Http_Cookie( $value, $url );
    744744            }
     
    871871
    872872        // Don't block requests back to ourselves by default.
    873         if ( 'localhost' == $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) {
     873        if ( 'localhost' === $check['host'] || ( isset( $home['host'] ) && $home['host'] == $check['host'] ) ) {
    874874            /**
    875875             * Filters whether to block local HTTP API requests.
     
    976976
    977977        // If it's a root-relative path, then great.
    978         if ( ! empty( $relative_url_parts['path'] ) && '/' == $relative_url_parts['path'][0] ) {
     978        if ( ! empty( $relative_url_parts['path'] ) && '/' === $relative_url_parts['path'][0] ) {
    979979            $path = $relative_url_parts['path'];
    980980
     
    10411041
    10421042        // POST requests should not POST to a redirected location.
    1043         if ( 'POST' == $args['method'] ) {
     1043        if ( 'POST' === $args['method'] ) {
    10441044            if ( in_array( $response['response']['code'], array( 302, 303 ), true ) ) {
    10451045                $args['method'] = 'GET';
Note: See TracChangeset for help on using the changeset viewer.