Make WordPress Core


Ignore:
Timestamp:
04/05/2020 03:00:44 AM (5 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-includes/l10n.php

    r47230 r47550  
    12091209
    12101210    $path = WP_LANG_DIR . '/plugins/' . $mofile;
    1211     if ( in_array( $path, $cached_mofiles ) ) {
     1211    if ( in_array( $path, $cached_mofiles, true ) ) {
    12121212        return $path;
    12131213    }
    12141214
    12151215    $path = WP_LANG_DIR . '/themes/' . $mofile;
    1216     if ( in_array( $path, $cached_mofiles ) ) {
     1216    if ( in_array( $path, $cached_mofiles, true ) ) {
    12171217        return $path;
    12181218    }
     
    13671367            continue;
    13681368        }
    1369         if ( ! in_array( substr( $file, 0, -3 ) . '.mo', $files ) ) {
     1369        if ( ! in_array( substr( $file, 0, -3 ) . '.mo', $files, true ) ) {
    13701370            continue;
    13711371        }
Note: See TracChangeset for help on using the changeset viewer.