Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/Cache/AnalysisCacheMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
use Composer\InstalledVersions;

use function array_map;
use function file_get_contents;
use function hash;
use function hash_file;
use function json_encode;
use function sort;

Expand Down Expand Up @@ -53,7 +53,7 @@ public function key(array $metadata): string

public function fileHash(string $path): string
{
return hash('xxh128', (string) file_get_contents($path));
return (string) hash_file('xxh128', $path);
}

/**
Expand All @@ -63,7 +63,7 @@ private function filesHash(array $files): string
{
return hash('xxh128', json_encode(array_map(static fn(string $file): array => [
'file' => $file,
'hash' => hash('xxh128', (string) file_get_contents($file)),
'hash' => (string) hash_file('xxh128', $file),
], $files), JSON_THROW_ON_ERROR));
}

Expand Down
3 changes: 2 additions & 1 deletion src/Cache/AnalysisResultCache.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use function file_put_contents;
use function glob;
use function hash;
use function hash_file;
use function is_array;
use function is_bool;
use function is_dir;
Expand Down Expand Up @@ -648,7 +649,7 @@ private function fileMetadata(string $file, string $namespace): array
return [
'namespace' => $namespace,
'file' => $file,
'hash' => hash('xxh128', (string) file_get_contents($file)),
'hash' => (string) hash_file('xxh128', $file),
];
}

Expand Down
Loading