class A {
/** @var string */
public $foo = "bar";
public function &getString() : string {
return $this->foo;
}
}
function useString(string &$s) : void {}
$a = new A();
useString($a->getString());
https://phpstan.org/r/da3db779cb2ac821b7ecc9ca8d4a1b71
Expected: No error
Actual: Parameter #1 $s of function useString is passed by reference, so it expects variables only.
Just fixed this in Psalm, was relatively painless.