1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Make Psalm insensitive to case-sensitive filenames

This commit is contained in:
Matt Brown 2017-03-16 10:58:13 -04:00
parent 04363237c5
commit 0c0a30d6ea
2 changed files with 6 additions and 6 deletions

View File

@ -753,7 +753,7 @@ class ProjectChecker
} catch (\ReflectionException $e) {
error_reporting($old_level);
$this->visited_classes[$fq_class_name_ci] = false;
// do not cache any results here (as case-sensitive filenames can screw things up)
return false;
}
@ -792,13 +792,13 @@ class ProjectChecker
return $this->visited_classes[$fq_class_name_ci];
}
$this->visited_classes[$fq_class_name_ci] = true;
// this registers the class if it's not user defined
if (!$this->fileExistsForClassLike($fq_class_name)) {
return false;
}
$this->visited_classes[$fq_class_name_ci] = true;
if (isset($this->classlike_files[$fq_class_name_ci])) {
$file_path = $this->classlike_files[$fq_class_name_ci];

View File

@ -6,7 +6,7 @@ use Psalm\Config;
class CacheProvider
{
const FILE_HASHES = 'file_hashes';
const FILE_HASHES = 'file_hashes_json';
const PARSER_CACHE_DIRECTORY = 'php-parser';
const GOOD_RUN_NAME = 'good_run';
@ -67,7 +67,7 @@ class CacheProvider
/** @var array<string, string> */
self::$file_content_hashes =
$root_cache_directory && is_readable($file_hashes_path)
? unserialize((string)file_get_contents($file_hashes_path))
? json_decode((string)file_get_contents($file_hashes_path), true)
: [];
}
@ -106,7 +106,7 @@ class CacheProvider
file_put_contents(
$root_cache_directory . DIRECTORY_SEPARATOR . self::FILE_HASHES,
serialize(self::$file_content_hashes)
json_encode(self::$file_content_hashes)
);
}
}