https://psalm.dev/r/560c67d308
<?php
function fooFunction (): string
{
try{
$foo = 'foo';
} finally {
}
return $foo;
}
Expected: No issues
Actual:
INFO: PossiblyUndefinedVariable - 10:12 - Possibly undefined variable $foo defined in try block
ERROR: InvalidReturnStatement - 10:12 - The inferred type 'string(foo)' does not match the declared return type 'string' for fooFunction
ERROR: InvalidReturnType - 3:26 - The declared return type 'string' for fooFunction is incorrect, got 'string(foo)'