From 77c9d1ecbd16ce5eade96770a53318f8edbf5b3f Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Wed, 18 Jan 2017 23:35:23 -0500 Subject: [PATCH] If extending FileChecker, inline included stmts --- src/Psalm/Checker/StatementsChecker.php | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/src/Psalm/Checker/StatementsChecker.php b/src/Psalm/Checker/StatementsChecker.php index b96a411d9..5c2162fe9 100644 --- a/src/Psalm/Checker/StatementsChecker.php +++ b/src/Psalm/Checker/StatementsChecker.php @@ -609,14 +609,20 @@ class StatementsChecker extends SourceChecker implements StatementsSource if ($this->getFileChecker()->fileExists($path_to_file)) { $include_stmts = FileChecker::getStatementsForFile($path_to_file); - $include_file_checker = new FileChecker( - $path_to_file, - $current_file_checker->project_checker, - $include_stmts - ); - $include_file_checker->setFileName($this->getFileName(), $this->getFilePath()); - $include_file_checker->visit($context); - $include_file_checker->analyze(); + + if (is_subclass_of($current_file_checker, 'Psalm\\Checker\\FileChecker')) { + $this->analyze($include_stmts, $context); + } else { + $include_file_checker = new FileChecker( + $path_to_file, + $current_file_checker->project_checker, + $include_stmts + ); + $include_file_checker->setFileName($this->getFileName(), $this->getFilePath()); + $include_file_checker->visit($context); + $include_file_checker->analyze(); + } + return null; } }