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.
Built from https://develop.svn.wordpress.org/trunk@54895


git-svn-id: http://core.svn.wordpress.org/trunk@54447 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-11-29 21:00:14 +00:00
parent 15d01c9235
commit 1750d30863
3 changed files with 5 additions and 5 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 .= ' ';
}

View File

@ -16,7 +16,7 @@
*
* @global string $wp_version
*/
$wp_version = '6.2-alpha-54894';
$wp_version = '6.2-alpha-54895';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.