Make WordPress Core

Changeset 55642


Ignore:
Timestamp:
04/10/2023 12:54:28 PM (15 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison where count() is involved.

Follow-up to [1636], [6974], [8114], [10322], [13326], [14760], [18006], [18541], [19743], [23249], [24115], [33359].

Props aristath, poena, afercia, SergeyBiryukov.
See #57839.

Location:
trunk/src
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-importer.php

    r54133 r55642  
    4242                }
    4343            }
    44         } while ( count( $results ) == $limit );
     44        } while ( count( $results ) === $limit );
    4545
    4646        return $hashtable;
     
    111111                }
    112112            }
    113         } while ( count( $results ) == $limit );
     113        } while ( count( $results ) === $limit );
    114114
    115115        return $hashtable;
  • trunk/src/wp-admin/includes/menu.php

    r53196 r55642  
    242242        }
    243243
    244         if ( $i == $items_count ) { // Last item.
     244        if ( $i === $items_count ) { // Last item.
    245245            $classes           = $menu[ $order ][4];
    246246            $menu[ $order ][4] = add_cssclass( 'menu-top-last', $classes );
  • trunk/src/wp-includes/class-wp-query.php

    r55597 r55642  
    22532253                if ( ! $post_type ) {
    22542254                    $post_type = 'any';
    2255                 } elseif ( count( $post_type ) == 1 ) {
     2255                } elseif ( count( $post_type ) === 1 ) {
    22562256                    $post_type = $post_type[0];
    22572257                }
  • trunk/src/wp-includes/class-wp-rewrite.php

    r54391 r55642  
    14001400        foreach ( $this->extra_permastructs as $permastructname => $struct ) {
    14011401            if ( is_array( $struct ) ) {
    1402                 if ( count( $struct ) == 2 ) {
     1402                if ( count( $struct ) === 2 ) {
    14031403                    $rules = $this->generate_rewrite_rules( $struct[0], $struct[1] );
    14041404                } else {
  • trunk/src/wp-includes/class-wp-xmlrpc-server.php

    r55539 r55642  
    42444244
    42454245        // If no specific options where asked for, return all of them.
    4246         if ( count( $options ) == 0 ) {
     4246        if ( count( $options ) === 0 ) {
    42474247            $options = array_keys( $this->blog_options );
    42484248        }
  • trunk/src/wp-includes/deprecated.php

    r55620 r55642  
    22982298    $metas = array_map('maybe_unserialize', $metas);
    22992299
    2300     if ( count($metas) == 1 )
     2300    if ( count($metas) === 1 )
    23012301        return $metas[0];
    23022302    else
  • trunk/src/wp-includes/formatting.php

    r55563 r55642  
    11701170            $unicode_length += $encoded_char_length;
    11711171        } else {
    1172             if ( count( $values ) == 0 ) {
     1172            if ( count( $values ) === 0 ) {
    11731173                if ( $value < 224 ) {
    11741174                    $num_octets = 2;
     
    11851185                break;
    11861186            }
    1187             if ( count( $values ) == $num_octets ) {
     1187            if ( count( $values ) === $num_octets ) {
    11881188                for ( $j = 0; $j < $num_octets; $j++ ) {
    11891189                    $unicode .= '%' . dechex( $values[ $j ] );
     
    33923392    global $wpsmiliestrans;
    33933393
    3394     if ( count( $matches ) == 0 ) {
     3394    if ( count( $matches ) === 0 ) {
    33953395        return '';
    33963396    }
     
    52435243    $args   = (array) $args;
    52445244    $result = array_shift( $args );
    5245     if ( count( $args ) == 1 ) {
     5245    if ( count( $args ) === 1 ) {
    52465246        $result .= $l['between_only_two'] . array_shift( $args );
    52475247    }
     
    52525252        $arg = array_shift( $args );
    52535253        $i--;
    5254         if ( 0 == $i ) {
     5254        if ( 0 === $i ) {
    52555255            $result .= $l['between_last_two'] . $arg;
    52565256        } else {
  • trunk/src/wp-includes/functions.php

    r55641 r55642  
    47554755    $wpsmiliestrans = apply_filters( 'smilies', $wpsmiliestrans );
    47564756
    4757     if ( count( $wpsmiliestrans ) == 0 ) {
     4757    if ( count( $wpsmiliestrans ) === 0 ) {
    47584758        return;
    47594759    }
  • trunk/src/wp-includes/kses.php

    r55564 r55642  
    789789    $split = preg_split( '/\s*=\s*/', $attr, 2 );
    790790    $name  = $split[0];
    791     if ( count( $split ) == 2 ) {
     791    if ( count( $split ) === 2 ) {
    792792        $value = $split[1];
    793793
  • trunk/src/wp-includes/ms-functions.php

    r55526 r55642  
    275275
    276276    $blogs = get_blogs_of_user( $user_id );
    277     if ( count( $blogs ) == 0 ) {
     277    if ( count( $blogs ) === 0 ) {
    278278        update_user_meta( $user_id, 'primary_blog', '' );
    279279        update_user_meta( $user_id, 'source_domain', '' );
  • trunk/src/wp-includes/pluggable.php

    r55455 r55642  
    433433
    434434                    if ( preg_match( '/(.*)<(.+)>/', $address, $matches ) ) {
    435                         if ( count( $matches ) == 3 ) {
     435                        if ( count( $matches ) === 3 ) {
    436436                            $recipient_name = $matches[1];
    437437                            $address        = $matches[2];
  • trunk/src/wp-includes/post.php

    r55617 r55642  
    57335733            }
    57345734
    5735             if ( 0 == $p->post_parent && count( $revparts ) == $count + 1 && $p->post_name == $revparts[ $count ] ) {
     5735            if ( 0 == $p->post_parent && count( $revparts ) === $count + 1 && $p->post_name == $revparts[ $count ] ) {
    57365736                $foundid = $page->ID;
    57375737                if ( $page->post_type == $post_type ) {
  • trunk/src/wp-includes/template.php

    r55013 r55642  
    153153    $templates = array();
    154154
    155     if ( count( $post_types ) == 1 ) {
     155    if ( count( $post_types ) === 1 ) {
    156156        $post_type   = reset( $post_types );
    157157        $templates[] = "archive-{$post_type}.php";
Note: See TracChangeset for help on using the changeset viewer.