Coding Standards: Use strict type check for in_array() and array_search() where strings are involved.

This reduces the number of `WordPress.PHP.StrictInArray.MissingTrueStrict` issues from 486 to 50.

Includes minor code layout fixes for better readability.

See #49542.

git-svn-id: https://develop.svn.wordpress.org/trunk@47550 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov
2020-04-05 03:00:44 +00:00
parent 2e589142eb
commit 0b4e2c4604
140 changed files with 584 additions and 484 deletions

View File

@@ -502,7 +502,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
* @return mixed Property.
*/
public function __get( $name ) {
if ( in_array( $name, $this->compat_fields ) ) {
if ( in_array( $name, $this->compat_fields, true ) ) {
return $this->$name;
}
}
@@ -517,7 +517,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
* @return mixed Newly-set property.
*/
public function __set( $name, $value ) {
if ( in_array( $name, $this->compat_fields ) ) {
if ( in_array( $name, $this->compat_fields, true ) ) {
return $this->$name = $value;
}
}
@@ -531,7 +531,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
* @return bool Whether the property is set.
*/
public function __isset( $name ) {
if ( in_array( $name, $this->compat_fields ) ) {
if ( in_array( $name, $this->compat_fields, true ) ) {
return isset( $this->$name );
}
}
@@ -544,7 +544,7 @@ class WP_Text_Diff_Renderer_Table extends Text_Diff_Renderer {
* @param string $name Property to unset.
*/
public function __unset( $name ) {
if ( in_array( $name, $this->compat_fields ) ) {
if ( in_array( $name, $this->compat_fields, true ) ) {
unset( $this->$name );
}
}