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

Fix #3188 - register global variables as by-reference ones

This commit is contained in:
Brown 2020-04-19 13:15:04 -04:00
parent 3fa07e1a7b
commit e55fe0a0e8
2 changed files with 3 additions and 0 deletions

View File

@ -774,6 +774,8 @@ class StatementsAnalyzer extends SourceAnalyzer implements StatementsSource
: $this->getGlobalType($var_id);
$context->vars_possibly_in_scope[$var_id] = true;
$context->byref_constraints[$var_id] = new \Psalm\Internal\ReferenceConstraint();
}
}
}

View File

@ -544,6 +544,7 @@ class UnusedVariableTest extends TestCase
function example() : void {
global $a;
echo $a;
$a = "hello";
}
example();',
],