diff --git a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php index 837d945dc5a..d19e264e325 100644 --- a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php @@ -582,6 +582,7 @@ public function check(string $base_dir, bool $is_diff = false): void || $deleted_files === null || count($diff_files) > 200 ) { + $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); $this->visitAutoloadFiles(); $this->codebase->scanner->addFilesToShallowScan($this->extra_files); @@ -590,8 +591,6 @@ public function check(string $base_dir, bool $is_diff = false): void $this->config->initializePlugins($this); - $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); - $this->codebase->scanFiles($this->threads); $this->codebase->infer_types_from_usage = true; @@ -608,14 +607,13 @@ public function check(string $base_dir, bool $is_diff = false): void $file_list = array_diff($file_list, $deleted_files); if ($file_list) { + $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); $this->visitAutoloadFiles(); $this->checkDiffFilesWithConfig($this->config, $file_list); $this->config->initializePlugins($this); - $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); - $this->codebase->scanFiles($this->threads); } else { $diff_no_files = true; @@ -989,14 +987,14 @@ public function checkDir(string $dir_name): void { $this->file_reference_provider->loadReferenceCache(); + $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); + $this->checkDirWithConfig($dir_name, $this->config, true); $this->progress->startScanningFiles(); $this->config->initializePlugins($this); - $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); - $this->codebase->scanFiles($this->threads); $this->config->visitStubFiles($this->codebase, $this->progress); @@ -1116,6 +1114,8 @@ public function checkFile(string $file_path): void { $this->progress->debug('Checking ' . $file_path . "\n"); + $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); + $this->config->hide_external_errors = $this->config->isInProjectDirs($file_path); $this->codebase->addFilesToAnalyze([$file_path => $file_path]); @@ -1126,8 +1126,6 @@ public function checkFile(string $file_path): void $this->config->initializePlugins($this); - $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); - $this->codebase->scanFiles($this->threads); $this->config->visitStubFiles($this->codebase, $this->progress); @@ -1147,6 +1145,7 @@ public function checkFile(string $file_path): void */ public function checkPaths(array $paths_to_check): void { + $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); $this->visitAutoloadFiles(); $this->codebase->scanner->addFilesToShallowScan($this->extra_files); @@ -1168,7 +1167,6 @@ public function checkPaths(array $paths_to_check): void $this->config->initializePlugins($this); - $this->config->visitPreloadedStubFiles($this->codebase, $this->progress); $this->codebase->scanFiles($this->threads);