1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Add null as a possible type parameter to strval (#4100)

https://www.php.net/manual/en/language.types.string.php#language.types.string.casting mentions

> `NULL` is always converted to an empty string.

Which seems to indicate that it is a valid argument for it.

As opposed to stringifying other types (like arrays), `strval(null)` does not cause a warning in PHP.
This commit is contained in:
lhchavez 2020-09-01 06:21:32 -07:00 committed by Daniil Gentili
parent ee029a646b
commit d1a42f6c69
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7

View File

@ -680,7 +680,7 @@ function bcdiv(string $left_operand, string $right_operand, int $scale = 0): ?st
/**
* @psalm-pure
*
* @param scalar|object $var
* @param scalar|null|object $var
* @return string The string value of var.
*
* @psalm-flow ($var) -> return