Skip to content

Commit 7e751c0

Browse files
authored
Final improvements for reduced scanning (#11809)
1 parent e9c1231 commit 7e751c0

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

src/Psalm/Internal/Analyzer/ProjectAnalyzer.php

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,9 +371,6 @@ public static function getInstance(): ProjectAnalyzer
371371
/** @psalm-mutation-free */
372372
public function canReportIssues(string $file_path): bool
373373
{
374-
if (!$this->project_files_initialized) {
375-
return $this->config->isInProjectDirs($file_path);
376-
}
377374
$list = $this->project_files;
378375
return isset($list[$file_path]);
379376
}
@@ -986,7 +983,22 @@ public function checkPaths(array $paths_to_check): void
986983
$this->progress->write($this->generatePHPVersionMessage());
987984
$this->progress->startPhase(Phase::SCAN, $this->scanThreads);
988985

989-
//$this->initProjectFiles();
986+
if (!$this->project_files_initialized) {
987+
$file_extensions = $this->config->getFileExtensions();
988+
$this->project_files = [];
989+
foreach ($paths_to_check as $file_path) {
990+
if (is_dir($file_path)) {
991+
foreach ($this->file_provider->getFilesInDir(
992+
$file_path,
993+
$file_extensions,
994+
) as $file_path) {
995+
$this->project_files[$file_path] = $file_path;
996+
}
997+
} elseif (is_file($file_path)) {
998+
$this->project_files[$file_path] = $file_path;
999+
}
1000+
}
1001+
}
9901002
$this->initExtraFiles();
9911003

9921004
$this->config->visitPreloadedStubFiles($this->codebase, $this->progress);

0 commit comments

Comments
 (0)