Skip to content

Commit

Permalink
update leftover md5 in provider to commonly used hash
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Aug 16, 2022
1 parent 66c1a82 commit fad498a
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/Psalm/Internal/Provider/StatementsProvider.php
Expand Up @@ -26,7 +26,7 @@
use function array_merge;
use function count;
use function filemtime;
use function md5;
use function hash;
use function strlen;
use function strpos;

Expand Down Expand Up @@ -132,7 +132,11 @@ public function getStatementsForFile(string $file_path, string $php_version, ?Pr

$config = Config::getInstance();

$file_content_hash = md5($version . $file_contents);
if (PHP_VERSION_ID >= 80100) {
$file_content_hash = hash('xxh128', $version . $file_contents);
} else {
$file_content_hash = hash('md4', $version . $file_contents);
}

if (!$this->parser_cache_provider
|| (!$config->isInProjectDirs($file_path) && strpos($file_path, 'vendor'))
Expand Down Expand Up @@ -239,7 +243,11 @@ function (int $_): bool {
array_flip($unchanged_signature_members)
);

$file_path_hash = md5($file_path);
if (PHP_VERSION_ID >= 80100) {
$file_path_hash = hash('xxh128', $file_path);
} else {
$file_path_hash = hash('md4', $file_path);
}

$changed_members = array_map(
function (string $key) use ($file_path_hash): string {
Expand Down

0 comments on commit fad498a

Please sign in to comment.