Coding Standards: Always use strict type check for in_array().

This fixes the currently flagged `WordPress.PHP.StrictInArray.MissingTrueStrict` issues:
* `Not using strict comparison for in_array; supply true for third argument.`

These all do comparisons with strings, so all the more reason why it is imperative that a strict comparison is used.

Follow-up to [47550], [47557], [54155], [53480].

Props jrf.
See #56791.

git-svn-id: https://develop.svn.wordpress.org/trunk@54895 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2022-11-29 20:58:26 +00:00
parent 35421f2b07
commit 4b55a18d23
2 changed files with 4 additions and 4 deletions

View File

@ -299,7 +299,7 @@ class WP_Block_Type {
* null when value not found, or void when unknown property name provided.
*/
public function __get( $name ) {
if ( ! in_array( $name, $this->deprecated_properties ) ) {
if ( ! in_array( $name, $this->deprecated_properties, true ) ) {
return;
}
@ -327,7 +327,7 @@ class WP_Block_Type {
* or false otherwise.
*/
public function __isset( $name ) {
if ( ! in_array( $name, $this->deprecated_properties ) ) {
if ( ! in_array( $name, $this->deprecated_properties, true ) ) {
return false;
}
@ -346,7 +346,7 @@ class WP_Block_Type {
* @param mixed $value Property value.
*/
public function __set( $name, $value ) {
if ( ! in_array( $name, $this->deprecated_properties ) ) {
if ( ! in_array( $name, $this->deprecated_properties, true ) ) {
$this->{$name} = $value;
return;
}

View File

@ -2879,7 +2879,7 @@ if ( ! function_exists( 'get_avatar' ) ) :
$extra_attr .= "loading='{$loading}'";
}
if ( in_array( $args['decoding'], array( 'async', 'sync', 'auto' ) ) && ! preg_match( '/\bdecoding\s*=/', $extra_attr ) ) {
if ( in_array( $args['decoding'], array( 'async', 'sync', 'auto' ), true ) && ! preg_match( '/\bdecoding\s*=/', $extra_attr ) ) {
if ( ! empty( $extra_attr ) ) {
$extra_attr .= ' ';
}