Coding Standards: Use strict comparison in wp-includes/class-wp-hook.php.

Follow-up to [4955], [38571].

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

git-svn-id: https://develop.svn.wordpress.org/trunk@56511 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2023-09-04 11:38:37 +00:00
parent d0deb5bc66
commit fa9f8397bc

View File

@ -78,7 +78,7 @@ final class WP_Hook implements Iterator, ArrayAccess {
$this->callbacks[ $priority ][ $idx ] = array(
'function' => $callback,
'accepted_args' => $accepted_args,
'accepted_args' => (int) $accepted_args,
);
// If we're adding a new priority to the list, put them back in sorted order.
@ -304,12 +304,12 @@ final class WP_Hook implements Iterator, ArrayAccess {
}
// Avoid the array_slice() if possible.
if ( 0 == $the_['accepted_args'] ) {
if ( 0 === $the_['accepted_args'] ) {
$value = call_user_func( $the_['function'] );
} elseif ( $the_['accepted_args'] >= $num_args ) {
$value = call_user_func_array( $the_['function'], $args );
} else {
$value = call_user_func_array( $the_['function'], array_slice( $args, 0, (int) $the_['accepted_args'] ) );
$value = call_user_func_array( $the_['function'], array_slice( $args, 0, $the_['accepted_args'] ) );
}
}
} while ( false !== next( $this->iterations[ $nesting_level ] ) );