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-admin/includes/class-wp-screen.php

    r47219 r47550  
    11581158        foreach ( $columns as $column => $title ) {
    11591159            // Can't hide these for they are special.
    1160             if ( in_array( $column, $special ) ) {
     1160            if ( in_array( $column, $special, true ) ) {
    11611161                continue;
    11621162            }
     
    11751175            $id = "$column-hide";
    11761176            echo '<label>';
    1177             echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( ! in_array( $column, $hidden ), true, false ) . ' />';
     1177            echo '<input class="hide-column-tog" name="' . $id . '" type="checkbox" id="' . $id . '" value="' . $column . '"' . checked( ! in_array( $column, $hidden, true ), true, false ) . ' />';
    11781178            echo "$title</label>\n";
    11791179        }
     
    13111311        $view_mode_post_types = apply_filters( 'view_mode_post_types', $view_mode_post_types );
    13121312
    1313         if ( ! in_array( $this->post_type, $view_mode_post_types ) ) {
     1313        if ( ! in_array( $this->post_type, $view_mode_post_types, true ) ) {
    13141314            return;
    13151315        }
Note: See TracChangeset for help on using the changeset viewer.