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)