From 225e1dbff662232ce234621d1ad37f964419206d Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Tue, 26 Jan 2016 14:13:04 -0500 Subject: [PATCH] Check all class statements --- lib/ClassChecker.php | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/lib/ClassChecker.php b/lib/ClassChecker.php index 9d794ff33..c26f9cbe5 100644 --- a/lib/ClassChecker.php +++ b/lib/ClassChecker.php @@ -33,12 +33,24 @@ class ClassChecker implements StatementsSource self::checkClassName($this->_class->extends, $this->_namespace, $this->_aliased_classes, $this->_file_name); } + $leftover_stmts = []; + foreach ($this->_class->stmts as $stmt) { if ($stmt instanceof PhpParser\Node\Stmt\ClassMethod) { $method_checker = new ClassMethodChecker($stmt, $this); $method_checker->check(); + + } else { + $leftover_stmts[] = $stmt; } } + + if ($leftover_stmts) { + $scope_vars = []; + $possibly_in_scope_vars = []; + + (new StatementsChecker($this))->check($leftover_stmts, $scope_vars, $possibly_in_scope_vars); + } } public static function checkClassName(PhpParser\Node\Name $class_name, $namespace, array $aliased_classes, $file_name)