1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-29 20:28:59 +01:00

preserve analyzers until the end of file (#4834)

* preserve analyzers until the end of file

* remove unused variable
This commit is contained in:
orklah 2020-12-13 07:17:13 +01:00 committed by Daniil Gentili
parent fadb3a76e7
commit 1c2650fe65
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
3 changed files with 4 additions and 8 deletions

View File

@ -18,7 +18,7 @@ class TemplateAnalyzer extends Psalm\Internal\Analyzer\FileAnalyzer
{
const VIEW_CLASS = 'Your\\View\\Class';
public function analyze(?Context $file_context = null, bool $preserve_analyzers = false, ?Context $global_context = null): void
public function analyze(?Context $file_context = null, ?Context $global_context = null): void
{
$codebase = $this->project_analyzer->getCodebase();
$stmts = $codebase->getStatementsForFile($this->file_path);

View File

@ -123,7 +123,6 @@ class FileAnalyzer extends SourceAnalyzer
public function analyze(
?Context $file_context = null,
bool $preserve_analyzers = false,
?Context $global_context = null
): void {
$codebase = $this->project_analyzer->getCodebase();
@ -211,11 +210,6 @@ class FileAnalyzer extends SourceAnalyzer
$class_analyzer->analyze(null, $this->context);
}
if (!$preserve_analyzers) {
$this->class_analyzers_to_analyze = [];
$this->interface_analyzers_to_analyze = [];
}
if ($codebase->config->check_for_throws_in_global_scope) {
$uncaught_throws = $statements_analyzer->getUncaughtThrows($this->context);
foreach ($uncaught_throws as $possibly_thrown_exception => $codelocations) {
@ -277,6 +271,9 @@ class FileAnalyzer extends SourceAnalyzer
foreach ($codebase->config->after_file_checks as $plugin_class) {
$plugin_class::afterAnalyzeFile($this, $this->context, $file_storage, $codebase);
}
$this->class_analyzers_to_analyze = [];
$this->interface_analyzers_to_analyze = [];
}
/**

View File

@ -178,7 +178,6 @@ class IncludeAnalyzer
try {
$include_file_analyzer->analyze(
$context,
false,
$global_context
);
} catch (\Psalm\Exception\UnpreparedAnalysisException $e) {