-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add stubs for wp_get_archives (#197)
- Loading branch information
Showing
4 changed files
with
34 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
<?php | ||
|
||
/** | ||
* Note: | ||
* Starting from PHPStan 1.10.49, void types, including void in unions, are | ||
* transformed into null. | ||
* | ||
* @link https://github.com/phpstan/phpstan-src/pull/2778 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace PhpStubs\WordPress\Core\Tests; | ||
|
||
use function wp_get_archives; | ||
use function PHPStan\Testing\assertType; | ||
|
||
// Default value of true | ||
assertType('null', wp_get_archives()); | ||
|
||
// Explicit value of true|1 | ||
assertType('null', wp_get_archives(['echo' => true, 'key' => 'value'])); | ||
assertType('null', wp_get_archives(['echo' => 1, 'key' => 'value'])); | ||
|
||
// Explicit value of false|0 | ||
assertType('string', wp_get_archives(['echo' => false, 'key' => 'value'])); | ||
assertType('string', wp_get_archives(['echo' => 0, 'key' => 'value'])); | ||
|
||
// Unknown value | ||
assertType('string|null', wp_get_archives(['echo' => (bool)$GET['echo'], 'key' => 'value'])); | ||
assertType('string|null', wp_get_archives(['echo' => (int)$GET['echo'], 'key' => 'value'])); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters