mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix #2705 - mark by-ref args as used if not variables already
This commit is contained in:
parent
e92656c4cb
commit
2aebc522f1
@ -430,7 +430,9 @@ class CallAnalyzer
|
||||
return false;
|
||||
}
|
||||
|
||||
continue;
|
||||
if ($arg->value instanceof PhpParser\Node\Expr\Variable) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
$toggled_class_exists = false;
|
||||
|
@ -1408,6 +1408,21 @@ class UnusedVariableTest extends TestCase
|
||||
}
|
||||
}'
|
||||
],
|
||||
'passedByRefArrayOffset' => [
|
||||
'<?php
|
||||
$a = [
|
||||
"a" => [1],
|
||||
"b" => [2]
|
||||
];
|
||||
|
||||
foreach (["a"] as $e){
|
||||
takes_ref($a[$e]);
|
||||
}
|
||||
|
||||
function takes_ref(array &$p): void {
|
||||
echo implode(",", $p);
|
||||
}'
|
||||
],
|
||||
];
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user