From 8c20f018e03dfe18802543e37a83695b0babc073 Mon Sep 17 00:00:00 2001 From: kkmuffme <11071985+kkmuffme@users.noreply.github.com> Date: Wed, 24 Aug 2022 14:43:49 +0200 Subject: [PATCH] tests --- src/Psalm/Internal/Provider/ParserCacheProvider.php | 6 ++++-- tests/Internal/Provider/ParserInstanceCacheProvider.php | 9 +++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/src/Psalm/Internal/Provider/ParserCacheProvider.php b/src/Psalm/Internal/Provider/ParserCacheProvider.php index 714b483903a..7d352f5a561 100644 --- a/src/Psalm/Internal/Provider/ParserCacheProvider.php +++ b/src/Psalm/Internal/Provider/ParserCacheProvider.php @@ -253,8 +253,10 @@ public function cacheFileContents(string $file_path, string $file_contents): voi public function deleteOldParserCaches(float $time_before): int { - // bug in tests, cannot use $this->config, https://github.com/vimeo/psalm/pull/8415#issuecomment-1216982800 - $cache_directory = Config::getInstance()->getCacheDirectory(); + $cache_directory = $this->config->getCacheDirectory(); + + $this->existing_file_content_hashes = null; + $this->new_file_content_hashes = []; if (!$cache_directory) { return 0; diff --git a/tests/Internal/Provider/ParserInstanceCacheProvider.php b/tests/Internal/Provider/ParserInstanceCacheProvider.php index 9b81bfcef87..9b515cf20dc 100644 --- a/tests/Internal/Provider/ParserInstanceCacheProvider.php +++ b/tests/Internal/Provider/ParserInstanceCacheProvider.php @@ -82,6 +82,15 @@ public function cacheFileContents(string $file_path, string $file_contents): voi $this->file_contents_cache[$file_path] = $file_contents; } + public function deleteOldParserCaches(float $_unused_time_before): int + { + $this->file_contents_cache = []; + $this->file_content_hash = []; + $this->statements_cache = []; + $this->statements_cache_time = []; + return 0; + } + public function saveFileContentHashes(): void { }