Make WordPress Core


Ignore:
Timestamp:
04/05/2020 03:00:44 AM (6 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/network/site-new.php

    r47198 r47550  
    5353                $subdirectory_reserved_names = get_subdirectory_reserved_names();
    5454
    55                 if ( in_array( $domain, $subdirectory_reserved_names ) ) {
     55                if ( in_array( $domain, $subdirectory_reserved_names, true ) ) {
    5656                        wp_die(
    5757                                sprintf(
     
    7474                if ( '' === $_POST['WPLANG'] ) {
    7575                        $meta['WPLANG'] = ''; // en_US
    76                 } elseif ( in_array( $_POST['WPLANG'], get_available_languages() ) ) {
     76                } elseif ( in_array( $_POST['WPLANG'], get_available_languages(), true ) ) {
    7777                        $meta['WPLANG'] = $_POST['WPLANG'];
    7878                } elseif ( current_user_can( 'install_languages' ) && wp_can_install_language_pack() ) {
     
    261261
    262262                                        // Use English if the default isn't available.
    263                                         if ( ! in_array( $lang, $languages ) ) {
     263                                        if ( ! in_array( $lang, $languages, true ) ) {
    264264                                                $lang = '';
    265265                                        }
Note: See TracChangeset for help on using the changeset viewer.