Skip to content

Commit 0358641

Browse files
authored
Add test data for have_posts (#290)
1 parent 95be71f commit 0358641

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

tests/TypeInferenceTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ public function dataFileAsserts(): iterable
4343
yield from $this->gatherAssertTypes(__DIR__ . '/data/get_user.php');
4444
yield from $this->gatherAssertTypes(__DIR__ . '/data/get_user_by.php');
4545
yield from $this->gatherAssertTypes(__DIR__ . '/data/has_filter.php');
46+
yield from $this->gatherAssertTypes(__DIR__ . '/data/have_posts.php');
4647
yield from $this->gatherAssertTypes(__DIR__ . '/data/is_new_day.php');
4748
yield from $this->gatherAssertTypes(__DIR__ . '/data/is_wp_error.php');
4849
yield from $this->gatherAssertTypes(__DIR__ . '/data/mysql2date.php');

tests/data/have_posts.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpStubs\WordPress\Core\Tests;
6+
7+
use function have_posts;
8+
use function PHPStan\Testing\assertType;
9+
10+
assertType('bool', have_posts());
11+
12+
if (have_posts()) {
13+
assertType('bool', have_posts());
14+
}
15+
16+
if (! have_posts()) {
17+
assertType('bool', have_posts());
18+
}

0 commit comments

Comments
 (0)