Skip to content

Commit 4aa8bfd

Browse files
authored
Narrow return type of wp_get_wp_version (#384)
1 parent 313ec71 commit 4aa8bfd

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

functionMap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@
184184
'wp_get_script_tag' => ['non-falsy-string', 'attributes' => 'array<string, string|true>'],
185185
'wp_get_server_protocol' => ["'HTTP/1.0'|'HTTP/1.1'|'HTTP/2'|'HTTP/2.0'|'HTTP/3'"],
186186
'wp_get_speculation_rules_configuration' => ["array{mode: 'prefetch'|'prerender', eagerness: 'conservative'|'eager'|'moderate'}|null"],
187+
'wp_get_wp_version' => ['non-falsy-string'],
187188
'wp_hash' => ['lowercase-string&non-falsy-string', 'scheme' => "'auth'|'logged_in'|'nonce'|'secure_auth'"],
188189
'wp_html_split' => ['non-empty-list<string>'],
189190
'wp_http_validate_url' => ["(TUrl is numeric|'' ? false : TUrl|false)", '@phpstan-template TUrl' => 'of string', 'url' => 'TUrl'],
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpStubs\WordPress\Core\Tests;
6+
7+
use function wp_get_wp_version;
8+
use function PHPStan\Testing\assertType;
9+
10+
assertType('non-falsy-string', wp_get_wp_version());

wordpress-stubs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114230,6 +114230,7 @@ function clean_dirsize_cache($path)
114230114230
* @since 6.7.0
114231114231
*
114232114232
* @return string The current WordPress version.
114233+
* @phpstan-return non-falsy-string
114233114234
*/
114234114235
function wp_get_wp_version()
114235114236
{

0 commit comments

Comments
 (0)