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;
|
|
|
|
|
|
|
|
/** @var ?array */
|
|
|
|
private $cached_method_references;
|
|
|
|
|
|
|
|
/** @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 = [];
|
|
|
|
|
2018-10-17 21:52:58 +02:00
|
|
|
/** @var array<string, array{0: array<int, array{0: int, 1: string}>, 1: array<int, array{0: int, 1: string}>}> */
|
|
|
|
private $cached_file_maps = [];
|
|
|
|
|
2018-09-30 05:51:06 +02:00
|
|
|
public function __construct()
|
|
|
|
{
|
2019-01-14 07:27:51 +01:00
|
|
|
$this->config_changed = false;
|
2018-09-30 05:51:06 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*
|
|
|
|
* @psalm-suppress MixedAssignment
|
|
|
|
* @psalm-suppress MixedTypeCoercion
|
|
|
|
*/
|
|
|
|
public function getCachedFileReferences()
|
|
|
|
{
|
|
|
|
return $this->cached_file_references;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*
|
|
|
|
* @psalm-suppress MixedAssignment
|
|
|
|
* @psalm-suppress MixedTypeCoercion
|
|
|
|
*/
|
|
|
|
public function getCachedMethodReferences()
|
|
|
|
{
|
|
|
|
return $this->cached_method_references;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return ?array
|
|
|
|
*
|
|
|
|
* @psalm-suppress MixedAssignment
|
|
|
|
* @psalm-suppress MixedTypeCoercion
|
|
|
|
*/
|
|
|
|
public function getCachedIssues()
|
|
|
|
{
|
|
|
|
return $this->cached_issues;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedFileReferences(array $file_references)
|
|
|
|
{
|
|
|
|
$this->cached_file_references = $file_references;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setCachedMethodReferences(array $method_references)
|
|
|
|
{
|
|
|
|
$this->cached_method_references = $method_references;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @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
|
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
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array<string, array{0: array<int, array{0: int, 1: string}>, 1: array<int, array{0: int, 1: string}>}>
|
|
|
|
*/
|
|
|
|
public function getFileMapCache()
|
|
|
|
{
|
|
|
|
return $this->cached_file_maps;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array<
|
|
|
|
* string,
|
|
|
|
* array{0: array<int, array{0: int, 1: string}>, 1: array<int, array{0: int, 1: string}>}
|
|
|
|
* > $file_maps
|
|
|
|
* @return void
|
|
|
|
*/
|
|
|
|
public function setFileMapCache(array $file_maps)
|
|
|
|
{
|
|
|
|
$this->cached_file_maps = $file_maps;
|
|
|
|
}
|
2018-09-30 05:51:06 +02:00
|
|
|
}
|