Make WordPress Core


Ignore:
Timestamp:
03/17/2024 09:54:21 AM (9 months ago)
Author:
SergeyBiryukov
Message:

Coding Standards: Use strict comparison in wp-includes/class-wp-walker.php.

Follow-up to [6384], [6456], [6858], [8494], [8961].

Props aristath, poena, afercia, SergeyBiryukov.
See #60700.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/class-wp-walker.php

    r57648 r57848  
    148148
    149149        // Descend only when the depth is right and there are children for this element.
    150         if ( ( 0 == $max_depth || $max_depth > $depth + 1 ) && isset( $children_elements[ $id ] ) ) {
     150        if ( ( 0 === $max_depth || $max_depth > $depth + 1 ) && isset( $children_elements[ $id ] ) ) {
    151151
    152152            foreach ( $children_elements[ $id ] as $child ) {
     
    200200
    201201        // Flat display.
    202         if ( -1 == $max_depth ) {
     202        if ( -1 === $max_depth ) {
    203203            $empty_array = array();
    204204            foreach ( $elements as $e ) {
     
    236236            $children_elements  = array();
    237237            foreach ( $elements as $e ) {
    238                 if ( $root->$parent_field == $e->$parent_field ) {
     238                if ( $root->$parent_field === $e->$parent_field ) {
    239239                    $top_level_elements[] = $e;
    240240                } else {
     
    252252         * then we got orphans, which should be displayed regardless.
    253253         */
    254         if ( ( 0 == $max_depth ) && count( $children_elements ) > 0 ) {
     254        if ( ( 0 === $max_depth ) && count( $children_elements ) > 0 ) {
    255255            $empty_array = array();
    256256            foreach ( $children_elements as $orphans ) {
     
    295295
    296296        $count = -1;
    297         if ( -1 == $max_depth ) {
     297        if ( -1 === $max_depth ) {
    298298            $total_top = count( $elements );
    299299        }
     
    302302            $paging = false;
    303303            $start  = 0;
    304             if ( -1 == $max_depth ) {
     304            if ( -1 === $max_depth ) {
    305305                $end = $total_top;
    306306            }
     
    310310            $start  = ( (int) $page_num - 1 ) * (int) $per_page;
    311311            $end    = $start + $per_page;
    312             if ( -1 == $max_depth ) {
     312            if ( -1 === $max_depth ) {
    313313                $this->max_pages = (int) ceil( $total_top / $per_page );
    314314            }
     
    316316
    317317        // Flat display.
    318         if ( -1 == $max_depth ) {
     318        if ( -1 === $max_depth ) {
    319319            if ( ! empty( $args[0]['reverse_top_level'] ) ) {
    320320                $elements = array_reverse( $elements );
Note: See TracChangeset for help on using the changeset viewer.