Skip to content

Commit 2762ad8

Browse files
committed
fix(PathHelper): resolve PHPStan type errors from realpath() returning false
- Ensure realpath() result is validated before assignment - Convert false return value to fallback dirname(__DIR__, 2) - Guarantee $basePath is always a string, matching declared type - Prevent passing string|false into join() which strictly requires string Resolves PHPStan warnings: • Static property $basePath does not accept string|false • PathHelper::join() expects string, string|false given
1 parent 738e45f commit 2762ad8

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Helpers/PathHelper.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,13 @@ final class PathHelper
5858
*/
5959
public static function base(?string $append = null): string
6060
{
61-
self::$basePath ??= realpath(dirname(__DIR__, 2));
61+
if (self::$basePath === null) {
62+
$resolved = realpath(dirname(__DIR__, 2));
63+
self::$basePath = is_string($resolved)
64+
? $resolved
65+
: dirname(__DIR__, 2);
66+
}
67+
6268
return self::join(self::$basePath, $append);
6369
}
6470

0 commit comments

Comments
 (0)