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:
parent
3fa07e1a7b
commit
e55fe0a0e8
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -544,6 +544,7 @@ class UnusedVariableTest extends TestCase
|
||||
function example() : void {
|
||||
global $a;
|
||||
echo $a;
|
||||
$a = "hello";
|
||||
}
|
||||
example();',
|
||||
],
|
||||
|
Loading…
x
Reference in New Issue
Block a user