Coding Standards: Use strict comparison for more count() calls.

Follow-up to [47848].

Props mukesh27.
Fixes #50232. See #49542.

git-svn-id: https://develop.svn.wordpress.org/trunk@47851 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-05-23 16:20:10 +00:00
parent f37a28858d
commit 3e2d77ae04
3 changed files with 6 additions and 3 deletions

View File

@ -286,7 +286,9 @@ function wp_update_link( $linkdata ) {
$link = wp_slash( $link ); $link = wp_slash( $link );
// Passed link category list overwrites existing category list if not empty. // Passed link category list overwrites existing category list if not empty.
if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] ) && 0 != count( $linkdata['link_category'] ) ) { if ( isset( $linkdata['link_category'] ) && is_array( $linkdata['link_category'] )
&& count( $linkdata['link_category'] ) > 0
) {
$link_cats = $linkdata['link_category']; $link_cats = $linkdata['link_category'];
} else { } else {
$link_cats = $link['link_category']; $link_cats = $link['link_category'];

View File

@ -824,7 +824,7 @@ class WP_Date_Query {
case 'BETWEEN': case 'BETWEEN':
case 'NOT BETWEEN': case 'NOT BETWEEN':
if ( ! is_array( $value ) || 2 != count( $value ) ) { if ( ! is_array( $value ) || 2 !== count( $value ) ) {
$value = array( $value, $value ); $value = array( $value, $value );
} else { } else {
$value = array_values( $value ); $value = array_values( $value );

View File

@ -4237,7 +4237,8 @@ function wp_update_post( $postarr = array(), $wp_error = false ) {
// Passed post category list overwrites existing category list if not empty. // Passed post category list overwrites existing category list if not empty.
if ( isset( $postarr['post_category'] ) && is_array( $postarr['post_category'] ) if ( isset( $postarr['post_category'] ) && is_array( $postarr['post_category'] )
&& 0 != count( $postarr['post_category'] ) ) { && count( $postarr['post_category'] ) > 0
) {
$post_cats = $postarr['post_category']; $post_cats = $postarr['post_category'];
} else { } else {
$post_cats = $post['post_category']; $post_cats = $post['post_category'];