Make WordPress Core


Ignore:
Timestamp:
04/09/2020 03:41:04 PM (5 years ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict type check for in_array() and array_search().

This addresses all the remaining WordPress.PHP.StrictInArray.MissingTrueStrict issues in core.

Includes minor code layout fixes for better readability.

Follow-up to [47550].

See #49542.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/customize/class-wp-customize-nav-menu-setting.php

    r47428 r47557  
    180180
    181181                    if ( isset( $nav_menu_options['auto_add'] ) && is_array( $nav_menu_options['auto_add'] ) ) {
    182                         $value['auto_add'] = in_array( $term->term_id, $nav_menu_options['auto_add'] );
     182                        $value['auto_add'] = in_array( $term->term_id, $nav_menu_options['auto_add'], true );
    183183                    }
    184184                }
     
    189189            }
    190190        }
     191
    191192        return $value;
    192193    }
     
    603604        }
    604605
    605         $i = array_search( $menu_id, $nav_menu_options['auto_add'] );
     606        $i = array_search( $menu_id, $nav_menu_options['auto_add'], true );
     607
    606608        if ( $auto_add && false === $i ) {
    607609            array_push( $nav_menu_options['auto_add'], $this->term_id );
Note: See TracChangeset for help on using the changeset viewer.