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/class-wp-customize-widgets.php

    r47383 r47550  
    451451                        'title'       => $wp_registered_sidebars[ $sidebar_id ]['name'],
    452452                        'description' => $wp_registered_sidebars[ $sidebar_id ]['description'],
    453                         'priority'    => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ) ),
     453                        'priority'    => array_search( $sidebar_id, array_keys( $wp_registered_sidebars ), true ),
    454454                        'panel'       => 'widgets',
    455455                        'sidebar_id'  => $sidebar_id,
     
    578578        $parsed_widget_id = $this->parse_widget_id( $widget_id );
    579579        $width            = $wp_registered_widget_controls[ $widget_id ]['width'];
    580         $is_core          = in_array( $parsed_widget_id['id_base'], $this->core_widget_id_bases );
     580        $is_core          = in_array( $parsed_widget_id['id_base'], $this->core_widget_id_bases, true );
    581581        $is_wide          = ( $width > 250 && ! $is_core );
    582582
     
    12211221     */
    12221222    public function is_widget_rendered( $widget_id ) {
    1223         return in_array( $widget_id, $this->rendered_widgets );
     1223        return in_array( $widget_id, $this->rendered_widgets, true );
    12241224    }
    12251225
     
    12331233     */
    12341234    public function is_sidebar_rendered( $sidebar_id ) {
    1235         return in_array( $sidebar_id, $this->rendered_sidebars );
     1235        return in_array( $sidebar_id, $this->rendered_sidebars, true );
    12361236    }
    12371237
Note: See TracChangeset for help on using the changeset viewer.