From 4b55a18d23aa0d5b890e015d15c374b4c3da292c Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Tue, 29 Nov 2022 20:58:26 +0000 Subject: [PATCH] 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 --- src/wp-includes/class-wp-block-type.php | 6 +++--- src/wp-includes/pluggable.php | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wp-includes/class-wp-block-type.php b/src/wp-includes/class-wp-block-type.php index 505c504037..3b3787740a 100644 --- a/src/wp-includes/class-wp-block-type.php +++ b/src/wp-includes/class-wp-block-type.php @@ -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; } diff --git a/src/wp-includes/pluggable.php b/src/wp-includes/pluggable.php index 27e5d91b20..7ed917001b 100644 --- a/src/wp-includes/pluggable.php +++ b/src/wp-includes/pluggable.php @@ -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 .= ' '; }