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

If extending FileChecker, inline included stmts

This commit is contained in:
Matthew Brown 2017-01-18 23:35:23 -05:00
parent 87871e61f2
commit 77c9d1ecbd

View File

@ -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;
}
}