Skip to content

Commit

Permalink
fix reported phpstan issues
Browse files Browse the repository at this point in the history
  • Loading branch information
keradus committed Jul 14, 2023
1 parent c0d1120 commit d25c533
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Cache/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,10 @@ public function write(CacheInterface $cache): void
$oldCache = $this->readFromHandle($handle);
rewind($handle);

if ($oldCache) {
if (null !== $oldCache) {
$cache->backfillHashes($oldCache);
}
}

ftruncate($handle, 0);
fwrite($handle, $cache->toJson());
fflush($handle);
Expand All @@ -87,7 +86,14 @@ private function getFileCurrentMTime(): int
{
clearstatcache(true, $this->file);

return filemtime($this->file) ?: 0;
$mtime = filemtime($this->file);

if (false === $mtime) {
// cannot check mtime? OK, let's pretend file is old
$mtime = 0;
}

return $mtime;
}

/**
Expand Down

0 comments on commit d25c533

Please sign in to comment.