Coding Standards: Use strict comparison in WP_List_Util::filter().

Correct comments per the documentation standards.

See #49542, #49572.

git-svn-id: https://develop.svn.wordpress.org/trunk@48421 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-07-10 12:44:38 +00:00
parent 7b27f3f00a
commit 73d3e9cfd9

View File

@ -105,26 +105,22 @@ class WP_List_Util {
$matched = 0;
foreach ( $args as $m_key => $m_value ) {
if ( is_array( $obj ) ) {
// Treat object as an array
// Treat object as an array.
if ( array_key_exists( $m_key, $obj ) && ( $m_value == $obj[ $m_key ] ) ) {
$matched++;
}
} elseif ( is_object( $obj ) ) {
// Treat object as an object
// Treat object as an object.
if ( isset( $obj->{$m_key} ) && ( $m_value == $obj->{$m_key} ) ) {
$matched++;
}
}
}
if (
( 'AND' === $operator && $matched == $count ) ||
( 'OR' === $operator && $matched > 0 ) ||
( 'NOT' === $operator && 0 == $matched )
if ( ( 'AND' === $operator && $matched === $count )
|| ( 'OR' === $operator && $matched > 0 )
|| ( 'NOT' === $operator && 0 === $matched )
) {
$filtered[ $key ] = $obj;
}