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.
Built from https://develop.svn.wordpress.org/trunk@57848


git-svn-id: http://core.svn.wordpress.org/trunk@57349 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2024-03-17 09:56:16 +00:00
parent a0f10b0742
commit 4c0984a459
2 changed files with 9 additions and 9 deletions

View File

@ -147,7 +147,7 @@ class Walker {
$this->start_el( $output, $element, $depth, ...array_values( $args ) ); $this->start_el( $output, $element, $depth, ...array_values( $args ) );
// Descend only when the depth is right and there are children for this element. // Descend only when the depth is right and there are children for this element.
if ( ( 0 == $max_depth || $max_depth > $depth + 1 ) && isset( $children_elements[ $id ] ) ) { if ( ( 0 === $max_depth || $max_depth > $depth + 1 ) && isset( $children_elements[ $id ] ) ) {
foreach ( $children_elements[ $id ] as $child ) { foreach ( $children_elements[ $id ] as $child ) {
@ -199,7 +199,7 @@ class Walker {
$parent_field = $this->db_fields['parent']; $parent_field = $this->db_fields['parent'];
// Flat display. // Flat display.
if ( -1 == $max_depth ) { if ( -1 === $max_depth ) {
$empty_array = array(); $empty_array = array();
foreach ( $elements as $e ) { foreach ( $elements as $e ) {
$this->display_element( $e, $empty_array, 1, 0, $args, $output ); $this->display_element( $e, $empty_array, 1, 0, $args, $output );
@ -235,7 +235,7 @@ class Walker {
$top_level_elements = array(); $top_level_elements = array();
$children_elements = array(); $children_elements = array();
foreach ( $elements as $e ) { foreach ( $elements as $e ) {
if ( $root->$parent_field == $e->$parent_field ) { if ( $root->$parent_field === $e->$parent_field ) {
$top_level_elements[] = $e; $top_level_elements[] = $e;
} else { } else {
$children_elements[ $e->$parent_field ][] = $e; $children_elements[ $e->$parent_field ][] = $e;
@ -251,7 +251,7 @@ class Walker {
* If we are displaying all levels, and remaining children_elements is not empty, * If we are displaying all levels, and remaining children_elements is not empty,
* then we got orphans, which should be displayed regardless. * then we got orphans, which should be displayed regardless.
*/ */
if ( ( 0 == $max_depth ) && count( $children_elements ) > 0 ) { if ( ( 0 === $max_depth ) && count( $children_elements ) > 0 ) {
$empty_array = array(); $empty_array = array();
foreach ( $children_elements as $orphans ) { foreach ( $children_elements as $orphans ) {
foreach ( $orphans as $op ) { foreach ( $orphans as $op ) {
@ -294,14 +294,14 @@ class Walker {
$parent_field = $this->db_fields['parent']; $parent_field = $this->db_fields['parent'];
$count = -1; $count = -1;
if ( -1 == $max_depth ) { if ( -1 === $max_depth ) {
$total_top = count( $elements ); $total_top = count( $elements );
} }
if ( $page_num < 1 || $per_page < 0 ) { if ( $page_num < 1 || $per_page < 0 ) {
// No paging. // No paging.
$paging = false; $paging = false;
$start = 0; $start = 0;
if ( -1 == $max_depth ) { if ( -1 === $max_depth ) {
$end = $total_top; $end = $total_top;
} }
$this->max_pages = 1; $this->max_pages = 1;
@ -309,13 +309,13 @@ class Walker {
$paging = true; $paging = true;
$start = ( (int) $page_num - 1 ) * (int) $per_page; $start = ( (int) $page_num - 1 ) * (int) $per_page;
$end = $start + $per_page; $end = $start + $per_page;
if ( -1 == $max_depth ) { if ( -1 === $max_depth ) {
$this->max_pages = (int) ceil( $total_top / $per_page ); $this->max_pages = (int) ceil( $total_top / $per_page );
} }
} }
// Flat display. // Flat display.
if ( -1 == $max_depth ) { if ( -1 === $max_depth ) {
if ( ! empty( $args[0]['reverse_top_level'] ) ) { if ( ! empty( $args[0]['reverse_top_level'] ) ) {
$elements = array_reverse( $elements ); $elements = array_reverse( $elements );
$oldstart = $start; $oldstart = $start;

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.6-alpha-57847'; $wp_version = '6.6-alpha-57848';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.