From 9b507fe936304a07da1632e72c266d9cb4c4d8a3 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Sat, 16 Jan 2016 14:53:49 -0500 Subject: [PATCH] Add support for global stmts --- lib/FunctionChecker.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/lib/FunctionChecker.php b/lib/FunctionChecker.php index 9696e69cb..26f267d08 100644 --- a/lib/FunctionChecker.php +++ b/lib/FunctionChecker.php @@ -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);