1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-03 10:07:52 +01:00
This commit is contained in:
Andrew Nagy 2023-03-02 19:12:29 +00:00
parent 7760c399cc
commit 97eae625e9
2 changed files with 16 additions and 6 deletions

View File

@ -26,8 +26,11 @@ class ClassLikeStorageCacheProvider extends InternalClassLikeStorageCacheProvide
$this->cache[$fq_classlike_name_lc] = $storage;
}
public function getLatestFromCache(string $fq_classlike_name_lc, ?string $file_path, ?string $file_contents): ClassLikeStorage
{
public function getLatestFromCache(
string $fq_classlike_name_lc,
?string $file_path,
?string $file_contents
): ClassLikeStorage {
$cached_value = $this->loadFromCache($fq_classlike_name_lc);
if (!$cached_value) {

View File

@ -36,8 +36,11 @@ class ParserCacheProvider extends InternalParserCacheProvider
{
}
public function loadStatementsFromCache(string $file_path, int $file_modified_time, string $file_content_hash): ?array
{
public function loadStatementsFromCache(
string $file_path,
int $file_modified_time,
string $file_content_hash
): ?array {
if (isset($this->statements_cache[$file_path])
&& $this->statements_cache_time[$file_path] >= $file_modified_time
&& $this->file_content_hash[$file_path] === $file_content_hash
@ -63,8 +66,12 @@ class ParserCacheProvider extends InternalParserCacheProvider
/**
* @param list<PhpParser\Node\Stmt> $stmts
*/
public function saveStatementsToCache(string $file_path, string $file_content_hash, array $stmts, bool $touch_only): void
{
public function saveStatementsToCache(
string $file_path,
string $file_content_hash,
array $stmts,
bool $touch_only
): void {
$this->statements_cache[$file_path] = $stmts;
$this->statements_cache_time[$file_path] = microtime(true);
$this->file_content_hash[$file_path] = $file_content_hash;