2018-09-30 05:51:06 +02:00
|
|
|
<?php
|
2018-11-12 16:57:05 +01:00
|
|
|
namespace Psalm\Tests\Internal\Provider;
|
2018-09-30 05:51:06 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Used to determine which files reference other files, necessary for using the --diff
|
|
|
|
* option from the command line.
|
|
|
|
*/
|
2018-11-06 03:57:36 +01:00
|
|
|
class FakeFileReferenceCacheProvider extends \Psalm\Internal\Provider\FileReferenceCacheProvider
|
2018-09-30 05:51:06 +02:00
|
|
|
{
|
|
|
|
/** @var ?array */
|
|
|
|
private $cached_file_references;
|
|
|
|
|
2019-04-28 18:59:36 +02:00
|
|
|
/** @var ?array */
|
2020-04-02 23:17:55 +02:00
|
|
|
private $cached_classlike_files;
|
2019-04-28 18:59:36 +02:00
|
|
|
|
2020-03-26 17:35:27 +01:00
|
|
|
/** @var ?array */
|
|
|
|
private $cached_method_class_references;
|
|
|
|
|
2020-04-02 23:17:55 +02:00
|
|
|
/** @var ?array */
|
|
|
|
private $cached_nonmethod_class_references;
|
|
|
|
|
2018-09-30 05:51:06 +02:00
|
|
|
/** @var ?array */
|
2019-04-16 22:07:48 +02:00
|
|
|
private $cached_method_member_references;
|
|
|
|
|
|
|
|
/** @var ?array */
|
|
|
|
private $cached_file_member_references;
|
|
|
|
|
|
|
|
/** @var ?array */
|
|
|
|
private $cached_method_missing_member_references;
|
|
|
|
|
|
|
|
/** @var ?array */
|
|
|
|
private $cached_file_missing_member_references;
|
2018-09-30 05:51:06 +02:00
|
|
|
|
2019-04-27 23:38:24 +02:00
|
|
|
/** @var ?array */
|
|
|
|
private $cached_unknown_member_references;
|
|
|
|
|
2019-04-29 23:29:38 +02:00
|
|
|
/** @var ?array */
|
|
|
|
private $cached_method_param_uses;
|
|
|
|
|
2018-09-30 05:51:06 +02:00
|
|
|
/** @var ?array */
|
|
|
|
private $cached_issues;
|
|
|
|
|
2018-10-07 04:58:21 +02:00
|
|
|
/** @var array<string, array<string, int>> */
|
2018-09-30 05:51:06 +02:00
|
|
|
private $cached_correct_methods = [];
|
|
|
|
|
2019-06-21 23:10:35 +02:00
|
|
|
/**
|
|
|
|
* @var array<
|
|
|
|
* string,
|
|
|
|
* array{
|
2020-05-15 16:18:05 +02:00
|
|
|
* 0: array<int, array{0: int, 1: non-empty-string}>,
|
|
|
|
* 1: array<int, array{0: int, 1: non-empty-string}>,
|
|
|
|
* 2: array<int, array{0: int, 1: non-empty-string, 2: int}>
|
2019-06-21 23:10:35 +02:00
|
|
|
* }
|
|
|
|
* >
|
|
|
|
*/
|
2018-10-17 21:52:58 +02:00
|
|
|
private $cached_file_maps = [];
|
|
|
|
|
2020-06-06 22:57:25 +02:00
|
|
|
public function __construct()
|
|
|
|
{
|
2020-06-06 18:06:31 +02:00
|
|
|
$this->config = \Psalm\Config::getInstance();
|
|
|
|
}
|
|
|
|
|
2018-09-30 05:51:06 +02:00
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
|
|
|
public function getCachedFileReferences()
|
|
|
|
{
|
|
|
|
return $this->cached_file_references;
|
|
|
|
}
|
|
|
|
|
2019-04-28 18:59:36 +02:00
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
2020-04-02 23:17:55 +02:00
|
|
|
public function getCachedClassLikeFiles()
|
2019-04-28 18:59:36 +02:00
|
|
|
{
|
2020-04-02 23:17:55 +02:00
|
|
|
return $this->cached_classlike_files;
|
2019-04-28 18:59:36 +02:00
|
|
|
}
|
|
|
|
|
2020-03-26 17:35:27 +01:00
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
|
|
|
public function getCachedMethodClassReferences()
|
|
|
|
{
|
|
|
|
return $this->cached_method_class_references;
|
|
|
|
}
|
|
|
|
|
2020-04-02 23:17:55 +02:00
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
|
|
|
public function getCachedNonMethodClassReferences()
|
|
|
|
{
|
|
|
|
return $this->cached_method_class_references;
|
|
|
|
}
|
|
|
|
|
2018-09-30 05:51:06 +02:00
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
2019-04-16 22:07:48 +02:00
|
|
|
public function getCachedFileMemberReferences()
|
|
|
|
{
|
|
|
|
return $this->cached_file_member_references;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
|
|
|
public function getCachedMethodMemberReferences()
|
2018-09-30 05:51:06 +02:00
|
|
|
{
|
2019-04-16 22:07:48 +02:00
|
|
|
return $this->cached_method_member_references;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
|
|
|
public function getCachedFileMissingMemberReferences()
|
|
|
|
{
|
|
|
|
return $this->cached_file_missing_member_references;
|
|
|
|
}
|
|
|
|
|
2019-04-27 23:38:24 +02:00
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
|
|
|
public function getCachedMixedMemberNameReferences()
|
|
|
|
{
|
|
|
|
return $this->cached_unknown_member_references;
|
|
|
|
}
|
|
|
|
|
2019-04-16 22:07:48 +02:00
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
|
|
|
public function getCachedMethodMissingMemberReferences()
|
|
|
|
{
|
|
|
|
return $this->cached_method_missing_member_references;
|
2018-09-30 05:51:06 +02:00
|
|
|
}
|
|
|
|
|
2019-04-29 23:29:38 +02:00
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
|
|
|
public function getCachedMethodParamUses()
|
|
|
|
{
|
|
|
|
return $this->cached_method_missing_member_references;
|
|
|
|
}
|
|
|
|
|
2018-09-30 05:51:06 +02:00
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*/
|
|
|
|
public function getCachedIssues()
|
|
|
|
{
|
|
|
|
return $this->cached_issues;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedFileReferences(array $file_references)
|
|
|
|
{
|
|
|
|
$this->cached_file_references = $file_references;
|
|
|
|
}
|
|
|
|
|
2019-04-28 18:59:36 +02:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
2020-04-02 23:17:55 +02:00
|
|
|
public function setCachedClassLikeFiles(array $file_references)
|
2019-04-28 18:59:36 +02:00
|
|
|
{
|
2020-04-02 23:17:55 +02:00
|
|
|
$this->cached_classlike_files = $file_references;
|
2019-04-28 18:59:36 +02:00
|
|
|
}
|
|
|
|
|
2020-03-26 17:35:27 +01:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedMethodClassReferences(array $method_references)
|
|
|
|
{
|
|
|
|
$this->cached_method_class_references = $method_references;
|
|
|
|
}
|
|
|
|
|
2020-04-02 23:17:55 +02:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedNonMethodClassReferences(array $method_references)
|
|
|
|
{
|
|
|
|
$this->cached_nonmethod_class_references = $method_references;
|
|
|
|
}
|
|
|
|
|
2018-09-30 05:51:06 +02:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
2019-04-16 22:07:48 +02:00
|
|
|
public function setCachedMethodMemberReferences(array $method_references)
|
|
|
|
{
|
|
|
|
$this->cached_method_member_references = $method_references;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedMethodMissingMemberReferences(array $method_references)
|
|
|
|
{
|
|
|
|
$this->cached_method_missing_member_references = $method_references;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedFileMemberReferences(array $method_references)
|
|
|
|
{
|
|
|
|
$this->cached_file_member_references = $method_references;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedFileMissingMemberReferences(array $method_references)
|
2018-09-30 05:51:06 +02:00
|
|
|
{
|
2019-04-16 22:07:48 +02:00
|
|
|
$this->cached_file_missing_member_references = $method_references;
|
2018-09-30 05:51:06 +02:00
|
|
|
}
|
|
|
|
|
2019-04-27 23:38:24 +02:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedMixedMemberNameReferences(array $references)
|
|
|
|
{
|
|
|
|
$this->cached_unknown_member_references = $references;
|
|
|
|
}
|
|
|
|
|
2019-04-29 23:29:38 +02:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedMethodParamUses(array $uses)
|
|
|
|
{
|
|
|
|
$this->cached_method_param_uses = $uses;
|
|
|
|
}
|
|
|
|
|
2018-09-30 05:51:06 +02:00
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedIssues(array $issues)
|
|
|
|
{
|
|
|
|
$this->cached_issues = $issues;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-10-07 04:58:21 +02:00
|
|
|
* @return array<string, array<string, int>>
|
2018-09-30 05:51:06 +02:00
|
|
|
*/
|
2018-11-02 02:52:39 +01:00
|
|
|
public function getAnalyzedMethodCache()
|
2018-09-30 05:51:06 +02:00
|
|
|
{
|
|
|
|
return $this->cached_correct_methods;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2018-10-07 04:58:21 +02:00
|
|
|
* @param array<string, array<string, int>> $correct_methods
|
2019-03-23 19:27:54 +01:00
|
|
|
*
|
2018-09-30 05:51:06 +02:00
|
|
|
* @return void
|
|
|
|
*/
|
2018-11-02 02:52:39 +01:00
|
|
|
public function setAnalyzedMethodCache(array $correct_methods)
|
2018-09-30 05:51:06 +02:00
|
|
|
{
|
|
|
|
$this->cached_correct_methods = $correct_methods;
|
|
|
|
}
|
2018-10-17 21:52:58 +02:00
|
|
|
|
|
|
|
/**
|
2019-06-21 23:10:35 +02:00
|
|
|
* @return array<
|
|
|
|
* string,
|
|
|
|
* array{
|
2020-05-15 16:18:05 +02:00
|
|
|
* 0: array<int, array{0: int, 1: non-empty-string}>,
|
|
|
|
* 1: array<int, array{0: int, 1: non-empty-string}>,
|
|
|
|
* 2: array<int, array{0: int, 1: non-empty-string, 2: int}>
|
2019-06-21 23:10:35 +02:00
|
|
|
* }
|
|
|
|
* >
|
2018-10-17 21:52:58 +02:00
|
|
|
*/
|
|
|
|
public function getFileMapCache()
|
|
|
|
{
|
|
|
|
return $this->cached_file_maps;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array<
|
2019-06-21 23:10:35 +02:00
|
|
|
* string,
|
|
|
|
* array{
|
2020-05-15 16:18:05 +02:00
|
|
|
* 0: array<int, array{0: int, 1: non-empty-string}>,
|
|
|
|
* 1: array<int, array{0: int, 1: non-empty-string}>,
|
|
|
|
* 2: array<int, array{0: int, 1: non-empty-string, 2: int}>
|
2019-06-21 23:10:35 +02:00
|
|
|
* }
|
|
|
|
* > $file_maps
|
2019-03-23 19:27:54 +01:00
|
|
|
*
|
2018-10-17 21:52:58 +02:00
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setFileMapCache(array $file_maps)
|
|
|
|
{
|
|
|
|
$this->cached_file_maps = $file_maps;
|
|
|
|
}
|
2020-06-06 22:57:25 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array<string, array{int, int}> $mixed_counts
|
|
|
|
*
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setTypeCoverage(array $mixed_counts)
|
|
|
|
{
|
|
|
|
}
|
2018-09-30 05:51:06 +02:00
|
|
|
}
|