Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@
'newblog_notify_siteadmin' => [null, 'deprecated' => "''"],
'next_posts' => ['($display is true ? void : string)'],
'paginate_links' => ["(\$args is array{total: int<min, 1>}&array ? void : (\$args is array{type: 'array'}&array ? list<string> : string))"],
'path_is_absolute' => ['($path is non-falsy-string ? bool : false)', '@phpstan-assert-if-true =non-falsy-string $path' => ''],
'path_join' => ['non-falsy-string'],
'post_type_archive_title' => ['($display is true ? void : string|void)'],
'prep_atom_text_construct' => ["array{'html'|'text'|'xhtml', string}"],
Expand Down
24 changes: 24 additions & 0 deletions tests/data/assert/path-is-absolute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?php

declare(strict_types=1);

namespace PhpStubs\WordPress\Core\Tests;

use function path_is_absolute;
use function PHPStan\Testing\assertType;

$path = Faker::string();
if (path_is_absolute($path)) {
assertType('non-falsy-string', $path);
}
if (! path_is_absolute($path)) {
assertType('string', $path);
}

$path = Faker::nonFalsyString();
if (path_is_absolute($path)) {
assertType('non-falsy-string', $path);
}
if (! path_is_absolute($path)) {
assertType('non-falsy-string', $path);
}
13 changes: 13 additions & 0 deletions tests/data/return/path-is-absolute.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php

declare(strict_types=1);

namespace PhpStubs\WordPress\Core\Tests;

use function path_is_absolute;
use function PHPStan\Testing\assertType;

assertType('false', path_is_absolute(''));
assertType('false', path_is_absolute('0'));
assertType('bool', path_is_absolute('foo'));
assertType('bool', path_is_absolute(Faker::string()));
2 changes: 2 additions & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -130055,6 +130055,8 @@ function wp_mkdir_p($target)
*
* @param string $path File path.
* @return bool True if path is absolute, false is not absolute.
* @phpstan-assert-if-true =non-falsy-string $path
* @phpstan-return ($path is non-falsy-string ? bool : false)
*/
function path_is_absolute($path)
{
Expand Down
Loading