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
+3 -3
View File
@@ -157,7 +157,7 @@ if ( $new_admin_email && get_option( 'admin_email' ) !== $new_admin_email ) :
$languages = get_available_languages();
$translations = wp_get_available_translations();
if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) {
if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages, true ) ) {
$languages[] = WPLANG;
}
if ( ! empty( $languages ) || ! empty( $translations ) ) {
@@ -167,7 +167,7 @@ if ( ! empty( $languages ) || ! empty( $translations ) ) {
<td>
<?php
$locale = get_locale();
if ( ! in_array( $locale, $languages ) ) {
if ( ! in_array( $locale, $languages, true ) ) {
$locale = '';
}
@@ -276,7 +276,7 @@ if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists.
?>
<br />
<?php
if ( in_array( $tzstring, timezone_identifiers_list() ) ) {
if ( in_array( $tzstring, timezone_identifiers_list(), true ) ) {
$transitions = timezone_transitions_get( timezone_open( $tzstring ), time() );
// 0 index is the state at current time, 1 index is the next transition, if any.