mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Split up scanning into specific steps
This commit is contained in:
parent
870e242ec3
commit
7278feb811
@ -251,14 +251,29 @@ class Scanner
|
||||
*/
|
||||
public function scanFiles(ClassLikes $classlikes)
|
||||
{
|
||||
$filetype_scanners = $this->config->getFiletypeScanners();
|
||||
|
||||
$has_changes = false;
|
||||
|
||||
while ($this->files_to_scan || $this->classes_to_scan) {
|
||||
if ($this->files_to_scan) {
|
||||
$file_path = array_shift($this->files_to_scan);
|
||||
if ($this->scanFilePaths()) {
|
||||
$has_changes = true;
|
||||
}
|
||||
} else {
|
||||
$this->convertClassesToFilePaths($classlikes);
|
||||
}
|
||||
}
|
||||
|
||||
return $has_changes;
|
||||
}
|
||||
|
||||
private function scanFilePaths() : bool
|
||||
{
|
||||
$filetype_scanners = $this->config->getFiletypeScanners();
|
||||
$files_to_scan = $this->files_to_scan;
|
||||
$has_changes = false;
|
||||
$this->files_to_scan = [];
|
||||
|
||||
foreach ($files_to_scan as $file_path) {
|
||||
if (!isset($this->scanned_files[$file_path])
|
||||
|| (isset($this->files_to_deep_scan[$file_path]) && !$this->scanned_files[$file_path])
|
||||
) {
|
||||
@ -269,8 +284,21 @@ class Scanner
|
||||
);
|
||||
$has_changes = true;
|
||||
}
|
||||
} else {
|
||||
$fq_classlike_name = array_shift($this->classes_to_scan);
|
||||
}
|
||||
|
||||
return $has_changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
private function convertClassesToFilePaths(ClassLikes $classlikes)
|
||||
{
|
||||
$classes_to_scan = $this->classes_to_scan;
|
||||
|
||||
$this->classes_to_scan = [];
|
||||
|
||||
foreach ($classes_to_scan as $fq_classlike_name) {
|
||||
$fq_classlike_name_lc = strtolower($fq_classlike_name);
|
||||
|
||||
if (isset($this->reflected_classlikes_lc[$fq_classlike_name_lc])) {
|
||||
@ -316,9 +344,6 @@ class Scanner
|
||||
}
|
||||
}
|
||||
|
||||
return $has_changes;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $file_path
|
||||
* @param array<string, string> $filetype_scanners
|
||||
|
Loading…
x
Reference in New Issue
Block a user