1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +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) { } catch (\ReflectionException $e) {
error_reporting($old_level); 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; return false;
} }
@ -792,13 +792,13 @@ class ProjectChecker
return $this->visited_classes[$fq_class_name_ci]; 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 // this registers the class if it's not user defined
if (!$this->fileExistsForClassLike($fq_class_name)) { if (!$this->fileExistsForClassLike($fq_class_name)) {
return false; return false;
} }
$this->visited_classes[$fq_class_name_ci] = true;
if (isset($this->classlike_files[$fq_class_name_ci])) { if (isset($this->classlike_files[$fq_class_name_ci])) {
$file_path = $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 class CacheProvider
{ {
const FILE_HASHES = 'file_hashes'; const FILE_HASHES = 'file_hashes_json';
const PARSER_CACHE_DIRECTORY = 'php-parser'; const PARSER_CACHE_DIRECTORY = 'php-parser';
const GOOD_RUN_NAME = 'good_run'; const GOOD_RUN_NAME = 'good_run';
@ -67,7 +67,7 @@ class CacheProvider
/** @var array<string, string> */ /** @var array<string, string> */
self::$file_content_hashes = self::$file_content_hashes =
$root_cache_directory && is_readable($file_hashes_path) $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( file_put_contents(
$root_cache_directory . DIRECTORY_SEPARATOR . self::FILE_HASHES, $root_cache_directory . DIRECTORY_SEPARATOR . self::FILE_HASHES,
serialize(self::$file_content_hashes) json_encode(self::$file_content_hashes)
); );
} }
} }