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/menu.php

    r47434 r47550  
    136136                        $menu_icon = esc_url( $ptype_obj->menu_icon );
    137137                }
    138         } elseif ( in_array( $ptype, $builtin ) ) {
     138        } elseif ( in_array( $ptype, $builtin, true ) ) {
    139139                $menu_icon = 'dashicons-admin-' . $ptype;
    140140        }
    … …  
    153153        }
    154154
    155         if ( in_array( $ptype, $builtin ) ) {
     155        if ( in_array( $ptype, $builtin, true ) ) {
    156156                $ptype_menu_id = 'menu-' . $ptype_for_id . 's';
    157157        } else {
    … …  
    163163         */
    164164        $core_menu_positions = array( 59, 60, 65, 70, 75, 80, 85, 99 );
    165         while ( isset( $menu[ $ptype_menu_position ] ) || in_array( $ptype_menu_position, $core_menu_positions ) ) {
     165        while ( isset( $menu[ $ptype_menu_position ] ) || in_array( $ptype_menu_position, $core_menu_positions, true ) ) {
    166166                $ptype_menu_position++;
    167167        }
Note: See TracChangeset for help on using the changeset viewer.