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:
parent
fadb3a76e7
commit
1c2650fe65
@ -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);
|
||||
|
@ -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 = [];
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -178,7 +178,6 @@ class IncludeAnalyzer
|
||||
try {
|
||||
$include_file_analyzer->analyze(
|
||||
$context,
|
||||
false,
|
||||
$global_context
|
||||
);
|
||||
} catch (\Psalm\Exception\UnpreparedAnalysisException $e) {
|
||||
|
Loading…
Reference in New Issue
Block a user