moderntribe / square-one

Modern Tribe's legacy WordPress framework for the classic editor.
GNU General Public License v2.0
89 stars 20 forks source link

Bugfix: PHPStan have_posts() false positive #1029

Closed defunctl closed 2 years ago

defunctl commented 2 years ago

What does this do/fix?

QA

The following will no longer be tagged as While loop condition is always true. or Unreachable statement - code above always terminates.:

            <?php
            if ( have_posts() ) : ?>
                <div class="archive-loop__items g-3-up">
                    <?php while ( have_posts() ) :
                        the_post();
                        get_template_part( 'components/card/card', '', $c->get_extended_card_args(
                            $c->get_meta_primary(),
                            $c->get_meta_secondary()
                        ) );
                    endwhile; ?>
                </div>
                <?php get_template_part( 'components/pagination/loop/loop' );
            else :
                get_template_part( 'components/no_results/no_results' );
            endif;
            ?>

Tests

Does this have tests?