Make WordPress Core


Ignore:
Timestamp:
04/05/2020 03:00:44 AM (7 years ago)
Author:
SergeyBiryukov
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/options-general.php

    r47219 r47550  
    158158$languages    = get_available_languages();
    159159$translations = wp_get_available_translations();
    160 if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages ) ) {
     160if ( ! is_multisite() && defined( 'WPLANG' ) && '' !== WPLANG && 'en_US' !== WPLANG && ! in_array( WPLANG, $languages, true ) ) {
    161161        $languages[] = WPLANG;
    162162}
    … …  
    168168                        <?php
    169169                        $locale = get_locale();
    170                         if ( ! in_array( $locale, $languages ) ) {
     170                        if ( ! in_array( $locale, $languages, true ) ) {
    171171                                $locale = '';
    172172                        }
    … …  
    277277        <br />
    278278        <?php
    279         if ( in_array( $tzstring, timezone_identifiers_list() ) ) {
     279        if ( in_array( $tzstring, timezone_identifiers_list(), true ) ) {
    280280                $transitions = timezone_transitions_get( timezone_open( $tzstring ), time() );
    281281
Note: See TracChangeset for help on using the changeset viewer.