1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Fix bugs Psalm found

This commit is contained in:
Brown 2018-10-08 20:04:05 -04:00
parent e4e92ebd32
commit 55bb896868
3 changed files with 8 additions and 21 deletions

View File

@ -183,11 +183,9 @@ class Codebase
$this->classlikes = new Codebase\ClassLikes(
$this->config,
$this,
$providers->classlike_storage_provider,
$this->scanner,
$this->methods,
$this->debug_output
$this->methods
);
$this->populator = new Codebase\Populator(
$config,

View File

@ -26,11 +26,6 @@ use ReflectionProperty;
*/
class ClassLikes
{
/**
* @var Codebase
*/
private $codebase;
/**
* @var ClassLikeStorageProvider
*/
@ -106,28 +101,19 @@ class ClassLikes
*/
private $scanner;
/**
* @var bool
*/
private $debug_output;
/**
* @param bool $debug_output
*/
public function __construct(
Config $config,
Codebase $codebase,
ClassLikeStorageProvider $storage_provider,
Scanner $scanner,
Methods $methods,
$debug_output
Methods $methods
) {
$this->config = $config;
$this->classlike_storage_provider = $storage_provider;
$this->scanner = $scanner;
$this->debug_output = $debug_output;
$this->methods = $methods;
$this->codebase = $codebase;
$this->collectPredefinedClassLikes();
}

View File

@ -19,7 +19,7 @@ class ParserCacheProvider
/**
* A map of filename hashes to contents hashes
*
* @var array<string, string>|null
* @var array<string, string>
*/
protected $file_content_hashes = [];
@ -133,17 +133,20 @@ class ParserCacheProvider
$hashes_encoded = (string) file_get_contents($file_hashes_path);
if (!$hashes_encoded) {
return $this->file_content_hashes;
error_log('Unexpected value when loading from file content hashes');
return $this->file_content_hashes;
}
/** @psalm-suppress MixedAssignment */
$hashes_decoded = json_decode($hashes_encoded, true);
if (!is_array($hashes_decoded)) {
return $this->file_content_hashes;
error_log('Unexpected value ' . gettype($hashes_decoded));
return $this->file_content_hashes;
}
/** @var array<string, string> $hashes_decoded */
$this->file_content_hashes = $hashes_decoded;
}
}