Skip to content

Commit dc76120

Browse files
authored
path_join: narrow return type (#481)
1 parent 40dbc0a commit dc76120

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

functionMap.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@
180180
'newblog_notify_siteadmin' => [null, 'deprecated' => "''"],
181181
'next_posts' => ['($display is true ? void : string)'],
182182
'paginate_links' => ["(\$args is array{total: int<min, 1>}&array ? void : (\$args is array{type: 'array'}&array ? list<string> : string))"],
183+
'path_join' => ['non-falsy-string'],
183184
'post_type_archive_title' => ['($display is true ? void : string|void)'],
184185
'prep_atom_text_construct' => ["array{'html'|'text'|'xhtml', string}"],
185186
'previous_posts' => ['($display is true ? void : string)'],

tests/data/return/path-join.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace PhpStubs\WordPress\Core\Tests;
6+
7+
use function path_join;
8+
use function PHPStan\Testing\assertType;
9+
10+
assertType('non-falsy-string', path_join('', ''));
11+
assertType('non-falsy-string', path_join('base', 'path'));
12+
assertType('non-falsy-string', path_join(Faker::string(), Faker::string()));

wordpress-stubs.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130066,6 +130066,7 @@ function path_is_absolute($path)
130066130066
* @param string $base Base path.
130067130067
* @param string $path Path relative to $base.
130068130068
* @return string The path with the base or absolute path.
130069+
* @phpstan-return non-falsy-string
130069130070
*/
130070130071
function path_join($base, $path)
130071130072
{

0 commit comments

Comments
 (0)