WordPress.org

Make WordPress Core


Ignore:
Timestamp:
04/09/2020 03:41:04 PM (13 months 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/class-walker-page.php

    r47219 r47557  
    123123        if ( ! empty( $current_page ) ) {
    124124            $_current_page = get_post( $current_page );
    125             if ( $_current_page && in_array( $page->ID, $_current_page->ancestors ) ) {
     125
     126            if ( $_current_page && in_array( $page->ID, $_current_page->ancestors, true ) ) {
    126127                $css_class[] = 'current_page_ancestor';
    127128            }
     129
    128130            if ( $page->ID == $current_page ) {
    129131                $css_class[] = 'current_page_item';
    130             } elseif ( $_current_page && $page->ID == $_current_page->post_parent ) {
     132            } elseif ( $_current_page && $page->ID === $_current_page->post_parent ) {
    131133                $css_class[] = 'current_page_parent';
    132134            }
Note: See TracChangeset for help on using the changeset viewer.