mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Prevent unnecessary warnings
This commit is contained in:
parent
976d3bf787
commit
7268558aa7
@ -1746,6 +1746,7 @@ class ClassAnalyzer extends ClassLikeAnalyzer
|
|||||||
&& ($local_offset
|
&& ($local_offset
|
||||||
= array_search($t->param_name, array_keys($storage->template_types)))
|
= array_search($t->param_name, array_keys($storage->template_types)))
|
||||||
!== false
|
!== false
|
||||||
|
&& isset($storage->template_covariants[$local_offset])
|
||||||
&& $storage->template_covariants[$local_offset]
|
&& $storage->template_covariants[$local_offset]
|
||||||
) {
|
) {
|
||||||
if (IssueBuffer::accepts(
|
if (IssueBuffer::accepts(
|
||||||
|
@ -247,6 +247,13 @@ class Analyzer
|
|||||||
$project_analyzer->interpretRefactors();
|
$project_analyzer->interpretRefactors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$this->files_to_analyze = array_filter(
|
||||||
|
$this->files_to_analyze,
|
||||||
|
function (string $file_path) : bool {
|
||||||
|
return $this->file_provider->fileExists($file_path);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
$analysis_worker =
|
$analysis_worker =
|
||||||
/**
|
/**
|
||||||
* @param int $_
|
* @param int $_
|
||||||
|
@ -358,8 +358,9 @@ class Scanner
|
|||||||
$files_to_scan = array_filter(
|
$files_to_scan = array_filter(
|
||||||
$this->files_to_scan,
|
$this->files_to_scan,
|
||||||
function (string $file_path) : bool {
|
function (string $file_path) : bool {
|
||||||
return !isset($this->scanned_files[$file_path])
|
return $this->file_provider->fileExists($file_path)
|
||||||
|| (isset($this->files_to_deep_scan[$file_path]) && !$this->scanned_files[$file_path]);
|
&& (!isset($this->scanned_files[$file_path])
|
||||||
|
|| (isset($this->files_to_deep_scan[$file_path]) && !$this->scanned_files[$file_path]));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -35,6 +35,10 @@ class FileProvider
|
|||||||
return $this->open_files[strtolower($file_path)];
|
return $this->open_files[strtolower($file_path)];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!file_exists($file_path)) {
|
||||||
|
throw new \UnexpectedValueException('File ' . $file_path . ' should exist to get contents');
|
||||||
|
}
|
||||||
|
|
||||||
return (string)file_get_contents($file_path);
|
return (string)file_get_contents($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,6 +81,10 @@ class FileProvider
|
|||||||
*/
|
*/
|
||||||
public function getModifiedTime($file_path)
|
public function getModifiedTime($file_path)
|
||||||
{
|
{
|
||||||
|
if (!file_exists($file_path)) {
|
||||||
|
throw new \UnexpectedValueException('File should exist to get modified time');
|
||||||
|
}
|
||||||
|
|
||||||
return (int)filemtime($file_path);
|
return (int)filemtime($file_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -649,8 +649,8 @@ class FileReferenceCacheProvider
|
|||||||
$cache_directory = Config::getInstance()->getCacheDirectory();
|
$cache_directory = Config::getInstance()->getCacheDirectory();
|
||||||
|
|
||||||
if ($cache_directory) {
|
if ($cache_directory) {
|
||||||
if (file_exists($cache_directory)) {
|
if (!file_exists($cache_directory)) {
|
||||||
mkdir($cache_directory, 0777, true);
|
\mkdir($cache_directory, 0777, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
$config_hash_cache_location = $cache_directory . DIRECTORY_SEPARATOR . self::CONFIG_HASH_CACHE_NAME;
|
$config_hash_cache_location = $cache_directory . DIRECTORY_SEPARATOR . self::CONFIG_HASH_CACHE_NAME;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user