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/user.php

    r47634 r47808  
    911911    $result      = array();
    912912
    913     if ( 'time' == $strategy ) {
     913    if ( 'time' === $strategy ) {
    914914        if ( is_multisite() && get_current_blog_id() != $site_id ) {
    915915            switch_to_blog( $site_id );
     
    12521252    }
    12531253
    1254     if ( 'raw' == $context ) {
     1254    if ( 'raw' === $context ) {
    12551255        return $value;
    12561256    }
     
    12621262    $prefixed = false !== strpos( $field, 'user_' );
    12631263
    1264     if ( 'edit' == $context ) {
     1264    if ( 'edit' === $context ) {
    12651265        if ( $prefixed ) {
    12661266
     
    12831283        }
    12841284
    1285         if ( 'description' == $field ) {
     1285        if ( 'description' === $field ) {
    12861286            $value = esc_html( $value ); // textarea_escaped?
    12871287        } else {
    12881288            $value = esc_attr( $value );
    12891289        }
    1290     } elseif ( 'db' == $context ) {
     1290    } elseif ( 'db' === $context ) {
    12911291        if ( $prefixed ) {
    12921292            /** This filter is documented in wp-includes/post.php */
     
    13301330    }
    13311331
    1332     if ( 'user_url' == $field ) {
     1332    if ( 'user_url' === $field ) {
    13331333        $value = esc_url( $value );
    13341334    }
    13351335
    1336     if ( 'attribute' == $context ) {
     1336    if ( 'attribute' === $context ) {
    13371337        $value = esc_attr( $value );
    1338     } elseif ( 'js' == $context ) {
     1338    } elseif ( 'js' === $context ) {
    13391339        $value = esc_js( $value );
    13401340    }
     
    25072507
    25082508    // Check the username.
    2509     if ( '' == $sanitized_user_login ) {
     2509    if ( '' === $sanitized_user_login ) {
    25102510        $errors->add( 'empty_username', __( '<strong>Error</strong>: Please enter a username.' ) );
    25112511    } elseif ( ! validate_username( $user_login ) ) {
     
    25242524
    25252525    // Check the email address.
    2526     if ( '' == $user_email ) {
     2526    if ( '' === $user_email ) {
    25272527        $errors->add( 'empty_email', __( '<strong>Error</strong>: Please type your email address.' ) );
    25282528    } elseif ( ! is_email( $user_email ) ) {
Note: See TracChangeset for help on using the changeset viewer.