1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
psalm/tests/Internal/Provider/FakeFileReferenceCacheProvider.php

226 lines
5.9 KiB
PHP
Raw Normal View History

2018-09-30 05:51:06 +02:00
<?php
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_classlike_files;
/** @var ?array */
private $cached_method_class_references;
/** @var ?array */
private $cached_nonmethod_class_references;
2018-09-30 05:51:06 +02:00
/** @var ?array */
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;
/** @var ?array */
private $cached_method_param_uses;
2018-09-30 05:51:06 +02:00
/** @var ?array */
private $cached_issues;
/** @var array<string, array<string, int>> */
2018-09-30 05:51:06 +02:00
private $cached_correct_methods = [];
/**
* @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}>
* }
* >
*/
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();
}
public function getCachedFileReferences(): ?array
2018-09-30 05:51:06 +02:00
{
return $this->cached_file_references;
}
public function getCachedClassLikeFiles(): ?array
{
return $this->cached_classlike_files;
}
public function getCachedMethodClassReferences(): ?array
{
return $this->cached_method_class_references;
}
public function getCachedNonMethodClassReferences(): ?array
{
return $this->cached_method_class_references;
}
public function getCachedFileMemberReferences(): ?array
{
return $this->cached_file_member_references;
}
public function getCachedMethodMemberReferences(): ?array
2018-09-30 05:51:06 +02:00
{
return $this->cached_method_member_references;
}
public function getCachedFileMissingMemberReferences(): ?array
{
return $this->cached_file_missing_member_references;
}
public function getCachedMixedMemberNameReferences(): ?array
2019-04-27 23:38:24 +02:00
{
return $this->cached_unknown_member_references;
}
public function getCachedMethodMissingMemberReferences(): ?array
{
return $this->cached_method_missing_member_references;
2018-09-30 05:51:06 +02:00
}
public function getCachedMethodParamUses(): ?array
{
return $this->cached_method_missing_member_references;
}
public function getCachedIssues(): ?array
2018-09-30 05:51:06 +02:00
{
return $this->cached_issues;
}
public function setCachedFileReferences(array $file_references): void
2018-09-30 05:51:06 +02:00
{
$this->cached_file_references = $file_references;
}
public function setCachedClassLikeFiles(array $file_references): void
{
$this->cached_classlike_files = $file_references;
}
public function setCachedMethodClassReferences(array $method_class_references): void
{
2020-08-10 05:19:59 +02:00
$this->cached_method_class_references = $method_class_references;
}
public function setCachedNonMethodClassReferences(array $file_class_references): void
{
2020-08-10 05:19:59 +02:00
$this->cached_nonmethod_class_references = $file_class_references;
}
public function setCachedMethodMemberReferences(array $member_references): void
{
2020-08-10 05:19:59 +02:00
$this->cached_method_member_references = $member_references;
}
public function setCachedMethodMissingMemberReferences(array $member_references): void
{
2020-08-10 05:19:59 +02:00
$this->cached_method_missing_member_references = $member_references;
}
public function setCachedFileMemberReferences(array $member_references): void
{
2020-08-10 05:19:59 +02:00
$this->cached_file_member_references = $member_references;
}
public function setCachedFileMissingMemberReferences(array $member_references): void
2018-09-30 05:51:06 +02:00
{
2020-08-10 05:19:59 +02:00
$this->cached_file_missing_member_references = $member_references;
2018-09-30 05:51:06 +02:00
}
public function setCachedMixedMemberNameReferences(array $references): void
2019-04-27 23:38:24 +02:00
{
$this->cached_unknown_member_references = $references;
}
public function setCachedMethodParamUses(array $uses): void
{
$this->cached_method_param_uses = $uses;
}
public function setCachedIssues(array $issues): void
2018-09-30 05:51:06 +02:00
{
$this->cached_issues = $issues;
}
/**
* @return array<string, array<string, int>>
2018-09-30 05:51:06 +02:00
*/
public function getAnalyzedMethodCache(): array
2018-09-30 05:51:06 +02:00
{
return $this->cached_correct_methods;
}
/**
2020-08-10 05:19:59 +02:00
* @param array<string, array<string, int>> $analyzed_methods
2018-09-30 05:51:06 +02:00
*/
public function setAnalyzedMethodCache(array $analyzed_methods): void
2018-09-30 05:51:06 +02:00
{
2020-08-10 05:19:59 +02:00
$this->cached_correct_methods = $analyzed_methods;
2018-09-30 05:51:06 +02:00
}
2018-10-17 21:52:58 +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}>
* }
* >
2018-10-17 21:52:58 +02:00
*/
public function getFileMapCache(): array
2018-10-17 21:52:58 +02:00
{
return $this->cached_file_maps;
}
/**
* @param 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}>
* }
* > $file_maps
2018-10-17 21:52:58 +02:00
*/
public function setFileMapCache(array $file_maps): void
2018-10-17 21:52:58 +02:00
{
$this->cached_file_maps = $file_maps;
}
2020-06-06 22:57:25 +02:00
/**
* @param array<string, array{int, int}> $mixed_counts
*/
public function setTypeCoverage(array $mixed_counts): void
2020-06-06 22:57:25 +02:00
{
}
2018-09-30 05:51:06 +02:00
}