mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Clear up use of reloadFiles
This commit is contained in:
parent
69d9fd7e28
commit
2d22db4cb7
@ -290,6 +290,7 @@ class Codebase
|
|||||||
$referenced_files = array_combine($referenced_files, $referenced_files);
|
$referenced_files = array_combine($referenced_files, $referenced_files);
|
||||||
|
|
||||||
$this->scanner->addFilesToDeepScan($referenced_files);
|
$this->scanner->addFilesToDeepScan($referenced_files);
|
||||||
|
$this->addFilesToAnalyze(array_combine($candidate_files, $candidate_files));
|
||||||
$this->scanner->scanFiles($this->classlikes);
|
$this->scanner->scanFiles($this->classlikes);
|
||||||
|
|
||||||
$this->file_reference_provider->updateReferenceCache($this, $referenced_files);
|
$this->file_reference_provider->updateReferenceCache($this, $referenced_files);
|
||||||
|
@ -63,10 +63,7 @@ class IssueBuffer
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$e instanceof DuplicateClass
|
if (!$config->reportIssueInFile($issue_type, $e->getFilePath())) {
|
||||||
&& !$e instanceof DuplicateMethod
|
|
||||||
&& !$config->reportIssueInFile($issue_type, $e->getFilePath())
|
|
||||||
) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,11 +97,6 @@ class AnalyzedMethodTest extends \Psalm\Tests\TestCase
|
|||||||
|
|
||||||
$codebase->reloadFiles($this->project_analyzer, array_keys($end_files));
|
$codebase->reloadFiles($this->project_analyzer, array_keys($end_files));
|
||||||
|
|
||||||
foreach ($end_files as $file_path => $_) {
|
|
||||||
$codebase->addFilesToAnalyze([$file_path => $file_path]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$codebase->scanFiles();
|
|
||||||
$codebase->analyzer->loadCachedResults($this->project_analyzer);
|
$codebase->analyzer->loadCachedResults($this->project_analyzer);
|
||||||
|
|
||||||
$this->assertSame(
|
$this->assertSame(
|
||||||
|
@ -104,12 +104,6 @@ class CachedStorageTest extends \Psalm\Tests\TestCase
|
|||||||
|
|
||||||
$codebase->reloadFiles($this->project_analyzer, array_keys($analyzable_files + $vendor_files));
|
$codebase->reloadFiles($this->project_analyzer, array_keys($analyzable_files + $vendor_files));
|
||||||
|
|
||||||
foreach ($analyzable_files as $file_path => $_) {
|
|
||||||
$codebase->addFilesToAnalyze([$file_path => $file_path]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$codebase->scanFiles();
|
|
||||||
|
|
||||||
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -79,13 +79,6 @@ class ErrorAfterUpdateTest extends \Psalm\Tests\TestCase
|
|||||||
|
|
||||||
$codebase->reloadFiles($this->project_analyzer, array_keys($files));
|
$codebase->reloadFiles($this->project_analyzer, array_keys($files));
|
||||||
|
|
||||||
foreach ($files as $file_path => $contents) {
|
|
||||||
$this->file_provider->registerFile($file_path, $contents);
|
|
||||||
$codebase->addFilesToAnalyze([$file_path => $file_path]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$codebase->scanFiles();
|
|
||||||
|
|
||||||
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -93,12 +93,6 @@ class ErrorFixTest extends \Psalm\Tests\TestCase
|
|||||||
|
|
||||||
$codebase->reloadFiles($this->project_analyzer, array_keys($middle_files));
|
$codebase->reloadFiles($this->project_analyzer, array_keys($middle_files));
|
||||||
|
|
||||||
foreach ($middle_files as $file_path => $_) {
|
|
||||||
$codebase->addFilesToAnalyze([$file_path => $file_path]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$codebase->scanFiles();
|
|
||||||
|
|
||||||
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
||||||
|
|
||||||
$data = \Psalm\IssueBuffer::clear();
|
$data = \Psalm\IssueBuffer::clear();
|
||||||
@ -116,8 +110,6 @@ class ErrorFixTest extends \Psalm\Tests\TestCase
|
|||||||
$codebase->addFilesToAnalyze([$file_path => $file_path]);
|
$codebase->addFilesToAnalyze([$file_path => $file_path]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$codebase->scanFiles();
|
|
||||||
|
|
||||||
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
||||||
|
|
||||||
$data = \Psalm\IssueBuffer::clear();
|
$data = \Psalm\IssueBuffer::clear();
|
||||||
|
@ -106,10 +106,6 @@ class TemporaryUpdateTest extends \Psalm\Tests\TestCase
|
|||||||
|
|
||||||
$codebase->reloadFiles($this->project_analyzer, array_keys($file_stage));
|
$codebase->reloadFiles($this->project_analyzer, array_keys($file_stage));
|
||||||
|
|
||||||
foreach ($file_stage as $file_path => $contents) {
|
|
||||||
$codebase->addFilesToAnalyze([$file_path => $file_path]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
||||||
|
|
||||||
$data = \Psalm\IssueBuffer::clear();
|
$data = \Psalm\IssueBuffer::clear();
|
||||||
|
@ -156,9 +156,6 @@ class CompletionTest extends \Psalm\Tests\TestCase
|
|||||||
}'
|
}'
|
||||||
);
|
);
|
||||||
$codebase->reloadFiles($this->project_analyzer, ['somefile.php']);
|
$codebase->reloadFiles($this->project_analyzer, ['somefile.php']);
|
||||||
|
|
||||||
$codebase->addFilesToAnalyze(['somefile.php' => 'somefile.php']);
|
|
||||||
|
|
||||||
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
||||||
|
|
||||||
$this->assertSame(['B\A', '->'], $codebase->getCompletionDataAtPosition('somefile.php', new Position(8, 31)));
|
$this->assertSame(['B\A', '->'], $codebase->getCompletionDataAtPosition('somefile.php', new Position(8, 31)));
|
||||||
|
@ -213,8 +213,6 @@ class SymbolLookupTest extends \Psalm\Tests\TestCase
|
|||||||
|
|
||||||
$codebase->reloadFiles($this->project_analyzer, ['somefile.php']);
|
$codebase->reloadFiles($this->project_analyzer, ['somefile.php']);
|
||||||
|
|
||||||
$codebase->addFilesToAnalyze(['somefile.php' => 'somefile.php']);
|
|
||||||
|
|
||||||
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
$codebase->analyzer->analyzeFiles($this->project_analyzer, 1, false);
|
||||||
|
|
||||||
$symbol_at_position = $codebase->getReferenceAtPosition('somefile.php', new Position(10, 30));
|
$symbol_at_position = $codebase->getReferenceAtPosition('somefile.php', new Position(10, 30));
|
||||||
|
Loading…
Reference in New Issue
Block a user