Closed
Description
This bit is throwing a VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable
false positive for $notificationId
. It seems it has to do with array destructuring the result, because if changed to $bar
it disappears.
static function foo(DBC $db, int $notificationId): void {
[$bar] = $db->queryGetRowIndexed("
SELECT blah...
", [
"n.notificationId" => $notificationId
]);
}
And this one too, in $level
, although in this case it looks related to that "self reference assignment":
static function dotToMultiArray(
array $array
): array {
$multi = [];
foreach($array as $key => $value){
$level = &$multi;
foreach(explode(".", $key) as $node)
$level = &$level[$node];
$level = $value;
}
return $multi;
}