Skip to content

Commit 81598dd

Browse files
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. git-svn-id: https://develop.svn.wordpress.org/trunk@55642 602fd350-edb4-49c9-b593-d223f7449a82
1 parent ba2f30e commit 81598dd

13 files changed

Lines changed: 18 additions & 18 deletions

‎src/wp-admin/includes/class-wp-importer.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function get_imported_posts( $importer_name, $blog_id ) {
4141
$hashtable[ $r->meta_value ] = (int) $r->post_id;
4242
}
4343
}
44-
} while ( count( $results ) == $limit );
44+
} while ( count( $results ) === $limit );
4545

4646
return $hashtable;
4747
}
@@ -110,7 +110,7 @@ public function get_imported_comments( $blog_id ) {
110110
}
111111
}
112112
}
113-
} while ( count( $results ) == $limit );
113+
} while ( count( $results ) === $limit );
114114

115115
return $hashtable;
116116
}

‎src/wp-admin/includes/menu.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ function add_menu_classes( $menu ) {
241241
$first_item = false;
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 );
247247
}

‎src/wp-includes/class-wp-query.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2252,7 +2252,7 @@ public function get_posts() {
22522252
}
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
}
22582258

‎src/wp-includes/class-wp-rewrite.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1399,7 +1399,7 @@ public function rewrite_rules() {
13991399
// Extra permastructs.
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 {
14051405
$rules = $this->generate_rewrite_rules( $struct['struct'], $struct['ep_mask'], $struct['paged'], $struct['feed'], $struct['forcomments'], $struct['walk_dirs'], $struct['endpoints'] );

‎src/wp-includes/class-wp-xmlrpc-server.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4243,7 +4243,7 @@ public function wp_getOptions( $args ) {
42434243
}
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
}
42494249

‎src/wp-includes/deprecated.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2297,7 +2297,7 @@ function get_usermeta( $user_id, $meta_key = '' ) {
22972297

22982298
$metas = array_map('maybe_unserialize', $metas);
22992299

2300-
if ( count($metas) == 1 )
2300+
if ( count($metas) === 1 )
23012301
return $metas[0];
23022302
else
23032303
return $metas;

‎src/wp-includes/formatting.php‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,7 +1169,7 @@ function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters =
11691169
$unicode .= $encoded_char;
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;
11751175
} elseif ( $value < 240 ) {
@@ -1184,7 +1184,7 @@ function utf8_uri_encode( $utf8_string, $length = 0, $encode_ascii_characters =
11841184
if ( $length && ( $unicode_length + ( $num_octets * 3 ) ) > $length ) {
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 ] );
11901190
}
@@ -3391,7 +3391,7 @@ function wp_remove_targeted_link_rel_filters() {
33913391
function translate_smiley( $matches ) {
33923392
global $wpsmiliestrans;
33933393

3394-
if ( count( $matches ) == 0 ) {
3394+
if ( count( $matches ) === 0 ) {
33953395
return '';
33963396
}
33973397

@@ -5242,7 +5242,7 @@ function wp_sprintf_l( $pattern, $args ) {
52425242

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
}
52485248

@@ -5251,7 +5251,7 @@ function wp_sprintf_l( $pattern, $args ) {
52515251
while ( $i ) {
52525252
$arg = array_shift( $args );
52535253
$i--;
5254-
if ( 0 == $i ) {
5254+
if ( 0 === $i ) {
52555255
$result .= $l['between_last_two'] . $arg;
52565256
} else {
52575257
$result .= $l['between'] . $arg;

‎src/wp-includes/functions.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4754,7 +4754,7 @@ function smilies_init() {
47544754
*/
47554755
$wpsmiliestrans = apply_filters( 'smilies', $wpsmiliestrans );
47564756

4757-
if ( count( $wpsmiliestrans ) == 0 ) {
4757+
if ( count( $wpsmiliestrans ) === 0 ) {
47584758
return;
47594759
}
47604760

‎src/wp-includes/kses.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -788,7 +788,7 @@ function wp_kses_one_attr( $attr, $element ) {
788788
// Parse attribute name and value from input.
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

794794
// Remove quotes surrounding $value.

‎src/wp-includes/ms-functions.php‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ function remove_user_from_blog( $user_id, $blog_id = 0, $reassign = 0 ) {
274274
$user->remove_all_caps();
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', '' );
280280
}

0 commit comments

Comments
 (0)