1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +01:00
This commit is contained in:
Daniil Gentili 2023-10-19 20:16:15 +02:00
parent 9ddc39dc73
commit a8ccc92da4
8 changed files with 12 additions and 30 deletions

View File

@ -104,7 +104,7 @@ final class Clause implements Stringable
/** @psalm-suppress ImpureFunctionCall */
$data = serialize($possibility_strings);
$this->hash = PHP_VERSION_ID >= 8_01_00 ? hash('xxh128', $data) : hash('md4', $data);
$this->hash = hash('xxh128', $data);
}
$this->possibilities = $possibilities;

View File

@ -69,7 +69,7 @@ final class PsalmRestarter extends XdebugHandler
$opcache_loaded = extension_loaded('opcache') || extension_loaded('Zend OPcache');
if (PHP_VERSION_ID >= 8_00_00 && $opcache_loaded) {
if ($opcache_loaded) {
// restart to enable JIT if it's not configured in the optimal way
$opcache_settings = [
'enable_cli' => in_array(ini_get('opcache.enable_cli'), ['1', 'true', true, 1]),
@ -145,11 +145,11 @@ final class PsalmRestarter extends XdebugHandler
// if it wasn't loaded then we apparently don't have opcache installed and there's no point trying
// to tweak it
// If we're running on 7.4 there's no JIT available
if (PHP_VERSION_ID >= 8_00_00 && $opcache_loaded) {
if ($opcache_loaded) {
$additional_options = [
'-dopcache.enable_cli=true',
'-dopcache.jit_buffer_size=512M',
'-dopcache.jit=1205',
'-dopcache.jit=tracing',
'-dopcache.optimization_level=0x7FFEBFFF',
'-dopcache.preload=',
'-dopcache.log_verbosity_level=0',

View File

@ -210,9 +210,7 @@ final class ReflectorVisitor extends PhpParser\NodeVisitorAbstract implements Fi
$classlike_storage->class_implements['stringable'] = 'Stringable';
}
if (PHP_VERSION_ID >= 8_00_00) {
$this->codebase->scanner->queueClassLikeForScanning('Stringable');
}
$this->codebase->scanner->queueClassLikeForScanning('Stringable');
}
if (!$this->scan_deep) {

View File

@ -106,7 +106,7 @@ class ClassLikeStorageCacheProvider
private function getCacheHash(?string $_unused_file_path, ?string $file_contents): string
{
$data = $file_contents ?: $this->modified_timestamps;
return PHP_VERSION_ID >= 8_01_00 ? hash('xxh128', $data) : hash('md4', $data);
return hash('xxh128', $data);
}
private function loadFromCache(string $fq_classlike_name_lc, ?string $file_path): ?ClassLikeStorage
@ -152,7 +152,7 @@ class ClassLikeStorageCacheProvider
$data = $file_path ? strtolower($file_path) . ' ' : '';
$data .= $fq_classlike_name_lc;
$file_path_sha = PHP_VERSION_ID >= 8_01_00 ? hash('xxh128', $data) : hash('md4', $data);
$file_path_sha = hash('xxh128', $data);
return $parser_cache_directory
. DIRECTORY_SEPARATOR

View File

@ -113,7 +113,7 @@ class FileStorageCacheProvider
// the timestamp is only needed if we don't have file contents
// as same contents should give same results, independent of when file was modified
$data = $file_contents ?: $this->modified_timestamps;
return PHP_VERSION_ID >= 8_01_00 ? hash('xxh128', $data) : hash('md4', $data);
return hash('xxh128', $data);
}
/**
@ -157,11 +157,7 @@ class FileStorageCacheProvider
}
}
if (PHP_VERSION_ID >= 8_01_00) {
$hash = hash('xxh128', $file_path);
} else {
$hash = hash('md4', $file_path);
}
$hash = hash('xxh128', $file_path);
return $parser_cache_directory
. DIRECTORY_SEPARATOR

View File

@ -332,11 +332,7 @@ class ParserCacheProvider
private function getParserCacheKey(string $file_path): string
{
if (PHP_VERSION_ID >= 8_01_00) {
$hash = hash('xxh128', $file_path);
} else {
$hash = hash('md4', $file_path);
}
$hash = hash('xxh128', $file_path);
return $hash . ($this->cache->use_igbinary ? '-igbinary' : '') . '-r';
}

View File

@ -84,11 +84,7 @@ class ProjectCacheProvider
return true;
}
if (PHP_VERSION_ID >= 8_01_00) {
$hash = hash('xxh128', $lockfile_contents);
} else {
$hash = hash('md4', $lockfile_contents);
}
$hash = hash('xxh128', $lockfile_contents);
} else {
$hash = '';
}

View File

@ -111,11 +111,7 @@ final class StatementsProvider
$config = Config::getInstance();
if (PHP_VERSION_ID >= 8_01_00) {
$file_content_hash = hash('xxh128', $version . $file_contents);
} else {
$file_content_hash = hash('md4', $version . $file_contents);
}
$file_content_hash = hash('xxh128', $version . $file_contents);
if (!$this->parser_cache_provider
|| (!$config->isInProjectDirs($file_path) && strpos($file_path, 'vendor'))