Skip to content

Commit

Permalink
use safeFileGetContents in ProjectCacheProvider too
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Dec 7, 2022
1 parent 1ee4b4a commit a33ffa7
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/Psalm/Internal/Provider/ProjectCacheProvider.php
Expand Up @@ -3,9 +3,9 @@
namespace Psalm\Internal\Provider;

use Psalm\Config;
use Psalm\Internal\Provider\Providers;

use function file_exists;
use function file_get_contents;
use function file_put_contents;
use function filemtime;
use function hash;
Expand Down Expand Up @@ -72,7 +72,7 @@ public function getLastRun(string $psalm_version): int

$run_cache_location = $cache_directory . DIRECTORY_SEPARATOR . self::GOOD_RUN_NAME;

if (file_exists($run_cache_location) && file_get_contents($run_cache_location) === $psalm_version) {
if (file_exists($run_cache_location) && Providers::safeFileGetContents($run_cache_location) === $psalm_version) {
$this->last_run = filemtime($run_cache_location);
} else {
$this->last_run = 0;
Expand All @@ -88,7 +88,7 @@ public function hasLockfileChanged(): bool
return true;
}

$lockfile_contents = file_get_contents($this->composer_lock_location);
$lockfile_contents = Providers::safeFileGetContents($this->composer_lock_location);

if (!$lockfile_contents) {
return true;
Expand Down Expand Up @@ -132,7 +132,7 @@ protected function getComposerLockHash(): string
$lock_hash_location = $cache_directory . DIRECTORY_SEPARATOR . self::COMPOSER_LOCK_HASH;

if (file_exists($lock_hash_location)) {
$this->composer_lock_hash = file_get_contents($lock_hash_location) ?: '';
$this->composer_lock_hash = Providers::safeFileGetContents($lock_hash_location) ?: '';
} else {
$this->composer_lock_hash = '';
}
Expand Down

0 comments on commit a33ffa7

Please sign in to comment.