Skip to content

Commit

Permalink
Merge pull request #6213 from weirdan/scan-preloaded-stubs-earlier
Browse files Browse the repository at this point in the history
Scan preloaded stubs earlier
  • Loading branch information
weirdan authored Jul 31, 2021
2 parents 7e137f5 + 2562e37 commit edffb1a
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/Psalm/Internal/Analyzer/ProjectAnalyzer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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]);
Expand All @@ -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);
Expand All @@ -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);
Expand All @@ -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);

Expand Down

0 comments on commit edffb1a

Please sign in to comment.