"Analyzes functions and methods control flow, reports unused variables and potentially unused variables (such variables are used in write context only)."
A simplified example.
function add(\ArrayObject $Foo, string $string)
{
// False positive below
$Foo[] = $string;
}
$Foo = new ArrayObject();
$Foo[] = 'one';
add($Foo, 'two');
var_dump($Foo);
exit;
@tfettig01, I'm in doubt here. Shouldn't $Foo be returned then as result?
@rentalhost @funivan : your thoughts?
Hello. I think this is definitely false positive.
Maybe this can be fixed in the following manner:
$foo don't need be returned here because it is an object. The method will affect the contents because of $foo[] (once that it is an ArrayObject). So it is a false-positive.
Ok, qualifying as a false-positive.
@tfettig01, I'm in doubt here. Shouldn't $Foo be returned then as result?
False positive? Yes.
Bad code? A definite maybe. Arguments could be made either way.
I'm seeing you took the issue as a false-positive. Thank you.
Fixed