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
2 changes: 1 addition & 1 deletion functionMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
'the_date' => ['($display is true ? void : string)'],
'the_modified_date' => ['($display is true ? void : string)'],
'the_title' => ['($display is true ? void : string|void)'],
'trailingslashit' => ['non-falsy-string'],
'trailingslashit' => ['non-falsy-string', '@phpstan-pure' => ''],
'urldecode_deep' => ['T', '@phpstan-template' => 'T', 'value' => 'T'],
'urlencode_deep' => ['T', '@phpstan-template' => 'T', 'value' => 'T'],
'validate_file' => ["(\$file is '' ? 0 : (\$allowed_files is empty ? 0|1|2 : 0|1|2|3))"],
Expand Down
18 changes: 18 additions & 0 deletions tests/data/pure/trailingslashit.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

declare(strict_types=1);

namespace PhpStubs\WordPress\Core\Tests;

use function trailingslashit;
use function PHPStan\Testing\assertType;

$toSlash = Faker::string();

if (trailingslashit($toSlash) === 'foo') {
assertType("'foo'", trailingslashit($toSlash));
}

if (trailingslashit($toSlash) !== 'foo') {
assertType('non-falsy-string', trailingslashit($toSlash));
}
1 change: 1 addition & 0 deletions wordpress-stubs.php
Original file line number Diff line number Diff line change
Expand Up @@ -109593,6 +109593,7 @@ function backslashit($value)
*
* @param string $value Value to which trailing slash will be added.
* @return string String with trailing slash added.
* @phpstan-pure
* @phpstan-return non-falsy-string
*/
function trailingslashit($value)
Expand Down
Loading