I found this bug. Not sure if it is "too complex" or not. I just thought to report it.
function takesAString(string $name): void {
echo "hello: ".$name;
}
function randomReturn(): ?string {
return rand(1,2) === 1 ? 'foo' : null;
}
$name = randomReturn();
// Assignment in if does not work
if ($hasStringValue = $name !== null) {
takesAString($name);
}
I found this bug. Not sure if it is "too complex" or not. I just thought to report it.
https://psalm.dev/r/c9ebe1f843