-
Notifications
You must be signed in to change notification settings - Fork 689
Closed
Description
Psalm is reporting the fourth argument of the mkdir() function cannot be null, but the function works as expected if used anyway.
The full message is:
Argument 4 of mkdir cannot be null, null value provided to parameter with type resource
And can be see with this example:
https://psalm.dev/r/6c64902528
mkdir("home/sample", 0755, true); // Works
mkdir("home/sample", 0755, true, null); // Also worksIt's difficult to find examples of how this parameter would be used, but PHP does support passing a null for this argument. The docs describe it that way as well.
https://www.php.net/manual/en/function.mkdir
mkdir(
string $directory,
int $permissions = 0777,
bool $recursive = false,
?resource $context = null
): bool