1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Use different psalm cache for different error levels

Fixes #4952
This commit is contained in:
Tyson Andre 2021-08-06 11:21:55 -04:00
parent 457695e466
commit 3486490080
4 changed files with 13 additions and 4 deletions

View File

@ -633,6 +633,14 @@ class Config
return $config;
}
/**
* Computes the hash to use for a cache folder from CLI flags and from the config file's xml contents
*/
public function computeHash(): string
{
return sha1($this->hash . ':' . $this->level);
}
/**
* Creates a new config object from an XML string
* @param string|null $current_dir Current working directory, if different to $base_dir

View File

@ -65,7 +65,7 @@ class ClassLikeStorageCacheProvider
$this->modified_timestamps .= ' ' . filemtime($dependent_file_path);
}
$this->modified_timestamps .= $this->config->hash;
$this->modified_timestamps .= $this->config->computeHash();
}
public function writeToCache(ClassLikeStorage $storage, ?string $file_path, ?string $file_contents): void

View File

@ -54,8 +54,9 @@ class FileReferenceCacheProvider
public function hasConfigChanged() : bool
{
$has_changed = $this->config->hash !== $this->getConfigHashCache();
$this->setConfigHashCache($this->config->hash);
$new_hash = $this->config->computeHash();
$has_changed = $new_hash !== $this->getConfigHashCache();
$this->setConfigHashCache($new_hash);
return $has_changed;
}

View File

@ -66,7 +66,7 @@ class FileStorageCacheProvider
$this->modified_timestamps .= ' ' . filemtime($dependent_file_path);
}
$this->modified_timestamps .= $this->config->hash;
$this->modified_timestamps .= $this->config->computeHash();
}
public function writeToCache(FileStorage $storage, string $file_contents): void