From 0fcad43581477e276b72b1f77f2bb1e9014b23ea Mon Sep 17 00:00:00 2001 From: Tomasz Mlynski Date: Mon, 6 Dec 2021 17:55:53 +0100 Subject: [PATCH] Simplify parser cache files maintenance Delete files that were not modified during a no-diff run --- src/Psalm/Internal/Analyzer/ProjectAnalyzer.php | 10 ++-------- src/Psalm/IssueBuffer.php | 4 ---- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php index 5844cedb9..bce31106c 100644 --- a/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php +++ b/src/Psalm/Internal/Analyzer/ProjectAnalyzer.php @@ -684,18 +684,12 @@ class ProjectAnalyzer true ); - if ($this->project_cache_provider && $this->parser_cache_provider) { - $removed_parser_files = $this->parser_cache_provider->deleteOldParserCaches( - $is_diff ? $this->project_cache_provider->getLastRun(PSALM_VERSION) : $start_checks - ); + if ($this->project_cache_provider && $this->parser_cache_provider && !$is_diff) { + $removed_parser_files = $this->parser_cache_provider->deleteOldParserCaches($start_checks); if ($removed_parser_files) { $this->progress->debug('Removed ' . $removed_parser_files . ' old parser caches' . "\n"); } - - if ($is_diff) { - $this->parser_cache_provider->touchParserCaches($this->getAllFiles($this->config), $start_checks); - } } } diff --git a/src/Psalm/IssueBuffer.php b/src/Psalm/IssueBuffer.php index 9d3837e32..b4857dfcc 100644 --- a/src/Psalm/IssueBuffer.php +++ b/src/Psalm/IssueBuffer.php @@ -746,10 +746,6 @@ class IssueBuffer if ($project_analyzer->project_cache_provider) { $project_analyzer->project_cache_provider->processSuccessfulRun($start_time, PSALM_VERSION); } - - if ($codebase->statements_provider->parser_cache_provider) { - $codebase->statements_provider->parser_cache_provider->processSuccessfulRun(); - } } if ($error_count