From 32059347a34aa1ac2e883202dcfbabec2d1f37ed Mon Sep 17 00:00:00 2001 From: Sergey Biryukov Date: Sun, 9 Feb 2025 18:49:51 +0000 Subject: [PATCH] Coding Standards: Use strict comparison in `WP_Query::the_post()` and `::have_posts()`. Follow-up to [2716], [2741], [11464]. Props aristath, poena, afercia, SergeyBiryukov. See #62279. git-svn-id: https://develop.svn.wordpress.org/trunk@59792 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-includes/class-wp-query.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/wp-includes/class-wp-query.php b/src/wp-includes/class-wp-query.php index 06b1e582a7b2c..f8d3d67d3fbd5 100644 --- a/src/wp-includes/class-wp-query.php +++ b/src/wp-includes/class-wp-query.php @@ -3752,7 +3752,7 @@ public function the_post() { $this->in_the_loop = true; $this->before_loop = false; - if ( -1 == $this->current_post ) { // Loop has just started. + if ( -1 === $this->current_post ) { // Loop has just started. /** * Fires once the loop is started. * @@ -3779,7 +3779,7 @@ public function the_post() { public function have_posts() { if ( $this->current_post + 1 < $this->post_count ) { return true; - } elseif ( $this->current_post + 1 == $this->post_count && $this->post_count > 0 ) { + } elseif ( $this->current_post + 1 === $this->post_count && $this->post_count > 0 ) { /** * Fires once the loop has ended. * @@ -3788,6 +3788,7 @@ public function have_posts() { * @param WP_Query $query The WP_Query instance (passed by reference). */ do_action_ref_array( 'loop_end', array( &$this ) ); + // Do some cleaning up after the loop. $this->rewind_posts(); } elseif ( 0 === $this->post_count ) {