1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 12:24:49 +01:00

Add support for global stmts

This commit is contained in:
Matthew Brown 2016-01-16 14:53:49 -05:00
parent b862073514
commit 9b507fe936

View File

@ -171,6 +171,19 @@ class FunctionChecker
$this->_aliased_classes[$use->alias] = implode('\\', $use->name->parts);
}
}
else if ($stmt instanceof PhpParser\Node\Stmt\Global_) {
foreach ($stmt->vars as $var) {
if ($var instanceof PhpParser\Node\Expr\Variable) {
if (is_string($var->name)) {
$vars_in_scope[$var->name] = true;
$vars_possibly_in_scope[$var->name] = true;
}
else {
$this->_checkExpression($var, $vars_in_scope, $vars_possibly_in_scope);
}
}
}
}
else {
var_dump('Unrecognised statement');
var_dump($stmt);