psalm
psalm copied to clipboard
False-positive `MixedArgument` (assignment in `if` clause)
https://psalm.dev/r/fe8e19a6dc
In else
branch $pos
is always int
.
I found these snippets:
https://psalm.dev/r/fe8e19a6dc
<?php
function foo(?string $foo): ?string {
if (null === $foo || false === $pos = strrpos($foo, '.')) {
// do something
} else {
$foo = substr($foo, 0, $pos);
}
return $foo;
}
Psalm output (using commit ef3b018):
INFO: MixedArgument - 7:32 - Argument 3 of substr cannot be mixed, expecting int|null