Skip to content

Commit

Permalink
Coding Standards: Use strict comparison in WP_Query::the_post() and…
Browse files Browse the repository at this point in the history
… `::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
  • Loading branch information
SergeyBiryukov committed Feb 9, 2025
1 parent 07034aa commit 3205934
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/wp-includes/class-wp-query.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand All @@ -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.
*
Expand All @@ -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 ) {
Expand Down

0 comments on commit 3205934

Please sign in to comment.