1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix unused ref in assign op

Fixes #1968
This commit is contained in:
Brown 2019-07-24 16:53:14 -04:00
parent ed61bcafda
commit e22e0ac92c
2 changed files with 8 additions and 0 deletions

View File

@ -847,6 +847,7 @@ class AssignmentAnalyzer
if ($lhs_var_id) {
$context->vars_in_scope[$lhs_var_id] = Type::getMixed();
$context->hasVariable($lhs_var_id, $statements_analyzer);
}
if ($rhs_var_id) {

View File

@ -1002,6 +1002,13 @@ class UnusedVariableTest extends TestCase
}
}',
],
'varPassedByRef' => [
'<?php
function foo(array $b) : void {
$a = &$b;
$a["foo"] = 5;
}',
],
];
}