1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

Cache errors as well as info issues

This commit is contained in:
Matthew Brown 2018-11-01 21:52:39 -04:00
parent ef671a14cc
commit 7d12bfd2d1
15 changed files with 147 additions and 113 deletions

View File

@ -506,13 +506,13 @@ class ClassChecker extends ClassLikeChecker
$included_file_path = $class_context->include_location->file_path;
}
$is_method_correct = $codebase->analyzer->isMethodCorrect(
$method_already_analyzed = $codebase->analyzer->isMethodAlreadyAnalyzed(
$included_file_path,
strtolower($fq_class_name) . '::__construct',
true
);
if ($is_method_correct) {
if ($method_already_analyzed) {
return;
}
@ -638,8 +638,6 @@ class ClassChecker extends ClassLikeChecker
}
if ($constructor_checker) {
$existing_error_count = IssueBuffer::getErrorCount();
$method_context = clone $class_context;
$method_context->collect_initializations = true;
$method_context->self = $fq_class_name;
@ -698,15 +696,11 @@ class ClassChecker extends ClassLikeChecker
}
}
$has_errors = IssueBuffer::getErrorCount() > $existing_error_count;
if (!$has_errors) {
$codebase->analyzer->setCorrectMethod(
$codebase->analyzer->setAnalyzedMethod(
$included_file_path,
strtolower($fq_class_name) . '::__construct',
true
);
}
return;
}
@ -974,7 +968,7 @@ class ClassChecker extends ClassLikeChecker
$trait_safe_method_id .= '&' . strtolower($actual_method_id);
}
$is_method_correct = $codebase->analyzer->isMethodCorrect(
$method_already_analyzed = $codebase->analyzer->isMethodAlreadyAnalyzed(
$included_file_path,
$trait_safe_method_id
);
@ -989,13 +983,13 @@ class ClassChecker extends ClassLikeChecker
}
if ($project_checker->diff_methods
&& $is_method_correct
&& $method_already_analyzed
&& !$class_context->collect_initializations
&& !$class_context->collect_mutations
&& !$is_fake
) {
if ($project_checker->debug_output) {
echo 'Skipping analysis of pre-verified method ' . $analyzed_method_id . "\n";
echo 'Skipping analysis of pre-analyzed method ' . $analyzed_method_id . "\n";
}
$existing_issues = $codebase->analyzer->getExistingIssuesForFile(
@ -1015,8 +1009,6 @@ class ClassChecker extends ClassLikeChecker
$end
);
$existing_error_count = IssueBuffer::getErrorCount();
$method_context = clone $class_context;
$method_context->collect_exceptions = $config->check_for_throws_docblock;
@ -1093,15 +1085,12 @@ class ClassChecker extends ClassLikeChecker
}
}
$has_errors = IssueBuffer::getErrorCount() > $existing_error_count;
if (!$is_method_correct
&& !$has_errors
if (!$method_already_analyzed
&& !$class_context->collect_initializations
&& !$class_context->collect_mutations
&& !$is_fake
) {
$codebase->analyzer->setCorrectMethod($included_file_path, $trait_safe_method_id);
$codebase->analyzer->setAnalyzedMethod($included_file_path, $trait_safe_method_id);
}
return $method_checker;

View File

@ -47,7 +47,6 @@ class NewChecker extends \Psalm\Checker\Statements\Expression\CallChecker
if ($context->calling_method_id
&& !$stmt->class instanceof PhpParser\Node\Name\FullyQualified
&& isset($aliases->uses[strtolower($stmt->class->parts[0])])
) {
$codebase->file_reference_provider->addReferenceToClassMethod(
$context->calling_method_id,

View File

@ -178,7 +178,6 @@ class StaticCallChecker extends \Psalm\Checker\Statements\Expression\CallChecker
if ($context->calling_method_id
&& !$stmt->class instanceof PhpParser\Node\Name\FullyQualified
&& isset($aliases->uses[strtolower($stmt->class->parts[0])])
) {
$codebase->file_reference_provider->addReferenceToClassMethod(
$context->calling_method_id,

View File

@ -567,7 +567,6 @@ class PropertyFetchChecker
if ($context->calling_method_id
&& !$stmt->class instanceof PhpParser\Node\Name\FullyQualified
&& isset($aliases->uses[strtolower($stmt->class->parts[0])])
) {
$codebase->file_reference_provider->addReferenceToClassMethod(
$context->calling_method_id,

View File

@ -1063,6 +1063,7 @@ class Codebase
{
$this->file_provider->addTemporaryFileChanges($file_path, $changes);
$this->invalidateInformationForFile($file_path);
$this->scanner->addFilesToDeepScan([$file_path => $file_path]);
$this->scanner->scanFiles($this->classlikes);
$this->populator->populateCodebase($this);

View File

@ -39,7 +39,7 @@ use Psalm\Provider\FileStorageProvider;
* file_references: array<string, array<string,bool>>,
* mixed_counts: array<string, array{0: int, 1: int}>,
* method_references: array<string, array<string,bool>>,
* correct_methods: array<string, array<string, int>>,
* analyzed_methods: array<string, array<string, int>>,
* file_maps: array<
* string,
* array{0: TaggedCodeType, 1: TaggedCodeType}
@ -96,7 +96,7 @@ class Analyzer
/**
* @var array<string, array<string, int>>
*/
private $correct_methods = [];
private $analyzed_methods = [];
/**
* @var array<string, array<int, IssueData>>
@ -235,7 +235,7 @@ class Analyzer
'file_references' => $file_reference_provider->getAllFileReferences(),
'method_references' => $file_reference_provider->getClassMethodReferences(),
'mixed_counts' => $analyzer->getMixedCounts(),
'correct_methods' => $analyzer->getCorrectMethods(),
'analyzed_methods' => $analyzer->getAnalyzedMethods(),
'file_maps' => $analyzer->getFileMaps(),
];
}
@ -256,7 +256,7 @@ class Analyzer
$project_checker->file_reference_provider->addFileReferences($pool_data['file_references']);
$project_checker->file_reference_provider->addClassMethodReferences($pool_data['method_references']);
$this->correct_methods = array_merge($pool_data['correct_methods'], $this->correct_methods);
$this->analyzed_methods = array_merge($pool_data['analyzed_methods'], $this->analyzed_methods);
foreach ($pool_data['mixed_counts'] as $file_path => list($mixed_count, $nonmixed_count)) {
if (!isset($this->mixed_counts[$file_path])) {
@ -290,7 +290,7 @@ class Analyzer
}
$scanned_files = $project_checker->codebase->scanner->getScannedFiles();
$project_checker->file_reference_provider->setCorrectMethods($this->correct_methods);
$project_checker->file_reference_provider->setAnalyzedMethods($this->analyzed_methods);
$project_checker->file_reference_provider->setFileMaps($this->getFileMaps());
$project_checker->file_reference_provider->updateReferenceCache($project_checker->codebase, $scanned_files);
@ -313,7 +313,7 @@ class Analyzer
if ($project_checker->diff_methods
&& (!$project_checker->codebase->collect_references || $project_checker->codebase->server_mode)
) {
$this->correct_methods = $project_checker->file_reference_provider->getCorrectMethods();
$this->analyzed_methods = $project_checker->file_reference_provider->getAnalyzedMethods();
$this->existing_issues = $project_checker->file_reference_provider->getExistingIssues();
$file_maps = $project_checker->file_reference_provider->getFileMaps();
@ -391,8 +391,8 @@ class Analyzer
}
}
foreach ($this->correct_methods as $file_path => $correct_methods) {
foreach ($correct_methods as $correct_method_id => $_) {
foreach ($this->analyzed_methods as $file_path => $analyzed_methods) {
foreach ($analyzed_methods as $correct_method_id => $_) {
$trait_safe_method_id = $correct_method_id;
$correct_method_ids = explode('&', $correct_method_id);
@ -403,7 +403,7 @@ class Analyzer
|| (isset($correct_method_ids[1])
&& isset($newly_invalidated_methods[$correct_method_ids[1]]))
) {
unset($this->correct_methods[$file_path][$trait_safe_method_id]);
unset($this->analyzed_methods[$file_path][$trait_safe_method_id]);
}
}
}
@ -424,7 +424,7 @@ class Analyzer
public function shiftFileOffsets(array $diff_map)
{
foreach ($this->existing_issues as $file_path => &$file_issues) {
if (!isset($this->correct_methods[$file_path])) {
if (!isset($this->analyzed_methods[$file_path])) {
unset($this->existing_issues[$file_path]);
continue;
}
@ -457,7 +457,7 @@ class Analyzer
}
foreach ($this->reference_map as $file_path => &$reference_map) {
if (!isset($this->correct_methods[$file_path])) {
if (!isset($this->analyzed_methods[$file_path])) {
unset($this->reference_map[$file_path]);
continue;
}
@ -489,7 +489,7 @@ class Analyzer
}
foreach ($this->type_map as $file_path => &$type_map) {
if (!isset($this->correct_methods[$file_path])) {
if (!isset($this->analyzed_methods[$file_path])) {
unset($this->type_map[$file_path]);
continue;
}
@ -849,9 +849,9 @@ class Analyzer
/**
* @return array<string, array<string, int>>
*/
public function getCorrectMethods()
public function getAnalyzedMethods()
{
return $this->correct_methods;
return $this->analyzed_methods;
}
/**
@ -894,9 +894,9 @@ class Analyzer
*
* @return void
*/
public function setCorrectMethod($file_path, $method_id, $is_constructor = false)
public function setAnalyzedMethod($file_path, $method_id, $is_constructor = false)
{
$this->correct_methods[$file_path][$method_id] = $is_constructor ? 2 : 1;
$this->analyzed_methods[$file_path][$method_id] = $is_constructor ? 2 : 1;
}
/**
@ -906,13 +906,13 @@ class Analyzer
*
* @return bool
*/
public function isMethodCorrect($file_path, $method_id, $is_constructor = false)
public function isMethodAlreadyAnalyzed($file_path, $method_id, $is_constructor = false)
{
if ($is_constructor) {
return isset($this->correct_methods[$file_path][$method_id])
&& $this->correct_methods[$file_path][$method_id] === 2;
return isset($this->analyzed_methods[$file_path][$method_id])
&& $this->analyzed_methods[$file_path][$method_id] === 2;
}
return isset($this->correct_methods[$file_path][$method_id]);
return isset($this->analyzed_methods[$file_path][$method_id]);
}
}

View File

@ -132,6 +132,20 @@ class FileStatementsDiffer extends AstDiffer
}
}
}
} elseif ($diff_elem->type === DiffElem::TYPE_ADD) {
if ($diff_elem->new instanceof PhpParser\Node\Stmt\Use_
|| $diff_elem->new instanceof PhpParser\Node\Stmt\GroupUse
) {
foreach ($diff_elem->new->uses as $use) {
if ($use->alias) {
$add_or_delete[] = 'use:' . (string) $use->alias;
} else {
$name_parts = $use->name->parts;
$add_or_delete[] = 'use:' . end($name_parts);
}
}
}
}
}

View File

@ -119,6 +119,20 @@ class NamespaceStatementsDiffer extends AstDiffer
}
}
}
} elseif ($diff_elem->type === DiffElem::TYPE_ADD) {
if ($diff_elem->new instanceof PhpParser\Node\Stmt\Use_
|| $diff_elem->new instanceof PhpParser\Node\Stmt\GroupUse
) {
foreach ($diff_elem->new->uses as $use) {
if ($use->alias) {
$add_or_delete[] = 'use:' . (string) $use->alias;
} else {
$name_parts = $use->name->parts;
$add_or_delete[] = 'use:' . end($name_parts);
}
}
}
}
}

View File

@ -133,7 +133,6 @@ class TextDocument
return;
}
$time = microtime(true);
$this->codebase->addTemporaryFileChanges($file_path, $contentChanges);
if ($this->onchange_line_limit !== null) {
@ -150,8 +149,6 @@ class TextDocument
$this->server->analyzePath($file_path);
$this->server->emitIssues($textDocument->uri);
$diff = microtime(true) - $time;
error_log('Scanning & Analysis took ' . number_format($diff, 3) . 's');
}
/**

View File

@ -30,7 +30,7 @@ use Psalm\Config;
class FileReferenceCacheProvider
{
const REFERENCE_CACHE_NAME = 'references';
const CORRECT_METHODS_CACHE_NAME = 'correct_methods';
const ANALYZED_METHODS_CACHE_NAME = 'analyzed_methods';
const CLASS_METHOD_CACHE_NAME = 'class_method_references';
const ISSUES_CACHE_NAME = 'issues';
const FILE_MAPS_CACHE_NAME = 'file_maps';
@ -191,37 +191,39 @@ class FileReferenceCacheProvider
/**
* @return array<string, array<string, int>>|false
*/
public function getCorrectMethodCache()
public function getAnalyzedMethodCache()
{
$cache_directory = $this->config->getCacheDirectory();
$correct_methods_cache_location = $cache_directory . DIRECTORY_SEPARATOR . self::CORRECT_METHODS_CACHE_NAME;
$analyzed_methods_cache_location = $cache_directory . DIRECTORY_SEPARATOR . self::ANALYZED_METHODS_CACHE_NAME;
if ($cache_directory
&& file_exists($correct_methods_cache_location)
&& file_exists($analyzed_methods_cache_location)
&& !$this->config_changed
) {
/** @var array<string, array<string, int>> */
return unserialize(file_get_contents($correct_methods_cache_location));
return unserialize(file_get_contents($analyzed_methods_cache_location));
}
return false;
}
/**
* @param array<string, array<string, int>> $correct_methods
* @param array<string, array<string, int>> $analyzed_methods
* @return void
*/
public function setCorrectMethodCache(array $correct_methods)
public function setAnalyzedMethodCache(array $analyzed_methods)
{
$cache_directory = Config::getInstance()->getCacheDirectory();
if ($cache_directory) {
$correct_methods_cache_location = $cache_directory . DIRECTORY_SEPARATOR . self::CORRECT_METHODS_CACHE_NAME;
$analyzed_methods_cache_location = $cache_directory
. DIRECTORY_SEPARATOR
. self::ANALYZED_METHODS_CACHE_NAME;
file_put_contents(
$correct_methods_cache_location,
serialize($correct_methods)
$analyzed_methods_cache_location,
serialize($analyzed_methods)
);
}
}

View File

@ -78,7 +78,7 @@ class FileReferenceProvider
/**
* @var array<string, array<string, int>>
*/
private static $correct_methods = [];
private static $analyzed_methods = [];
/**
* @var array<string, array<int, IssueData>>
@ -283,13 +283,13 @@ class FileReferenceProvider
self::$class_method_references = $class_method_references;
$correct_methods = $this->cache->getCorrectMethodCache();
$analyzed_methods = $this->cache->getAnalyzedMethodCache();
if ($correct_methods === false) {
if ($analyzed_methods === false) {
return false;
}
self::$correct_methods = $correct_methods;
self::$analyzed_methods = $analyzed_methods;
$issues = $this->cache->getCachedIssues();
@ -340,7 +340,7 @@ class FileReferenceProvider
$this->cache->setCachedMethodReferences(self::$class_method_references);
$this->cache->setCachedIssues(self::$issues);
$this->cache->setFileMapCache(self::$file_maps);
$this->cache->setCorrectMethodCache(self::$correct_methods);
$this->cache->setAnalyzedMethodCache(self::$analyzed_methods);
}
}
@ -432,12 +432,12 @@ class FileReferenceProvider
}
/**
* @param array<string, array<string, int>> $correct_methods
* @param array<string, array<string, int>> $analyzed_methods
* @return void
*/
public function setCorrectMethods(array $correct_methods)
public function setAnalyzedMethods(array $analyzed_methods)
{
self::$correct_methods = $correct_methods;
self::$analyzed_methods = $analyzed_methods;
}
/**
@ -452,9 +452,9 @@ class FileReferenceProvider
/**
* @return array<string, array<string, int>>
*/
public function getCorrectMethods()
public function getAnalyzedMethods()
{
return self::$correct_methods;
return self::$analyzed_methods;
}
/**
@ -476,7 +476,7 @@ class FileReferenceProvider
self::$deleted_files = null;
self::$file_references = [];
self::$class_method_references = [];
self::$correct_methods = [];
self::$analyzed_methods = [];
self::$issues = [];
self::$file_maps = [];
}

View File

@ -1185,7 +1185,7 @@ class FileDiffTest extends TestCase
}',
[],
[],
['foo\a::foo', 'foo\a::bar', 'foo\a::foo', 'foo\a::bar'],
['use:D', 'use:E', 'foo\a::foo', 'foo\a::bar', 'foo\a::foo', 'foo\a::bar'],
[]
],
'SKIPPED-whiteSpaceOnly' => [

View File

@ -175,6 +175,10 @@ class FileReferenceTest extends TestCase
}
}',
[
'use:A:170c429ab240e049ef0956f744ed16c7' => [
'foo\b::__construct' => true,
'foo\c::foo' => true,
],
'foo\a::__construct' => [
'foo\b::__construct' => true,
'foo\c::foo' => true,
@ -182,6 +186,9 @@ class FileReferenceTest extends TestCase
'foo\a::bat' => [
'foo\b::__construct' => true,
],
'use:C:170c429ab240e049ef0956f744ed16c7' => [
'foo\b::bar' => true,
],
'foo\c::__construct' => [
'foo\b::bar' => true,
],
@ -210,6 +217,9 @@ class FileReferenceTest extends TestCase
}
}',
[
'use:C:170c429ab240e049ef0956f744ed16c7' => [
'foo\d::bat' => true,
],
'foo\b::__construct' => [
'foo\d::bat' => true,
],
@ -277,6 +287,10 @@ class FileReferenceTest extends TestCase
}
}',
[
'use:A:170c429ab240e049ef0956f744ed16c7' => [
'foo\b::__construct' => true,
'foo\c::foo' => true,
],
'foo\a::$fooBar' => [
'foo\b::__construct' => true,
'foo\c::foo' => true,
@ -309,6 +323,10 @@ class FileReferenceTest extends TestCase
'foo\b::__construct' => true,
'foo\c::foo' => true,
],
'use:A:170c429ab240e049ef0956f744ed16c7' => [
'foo\b::__construct' => true,
'foo\c::foo' => true,
],
'foo\a::__construct' => [
'foo\b::__construct' => true,
'foo\c::foo' => true,

View File

@ -7,7 +7,7 @@ use Psalm\Provider\Providers;
use Psalm\Tests\TestConfig;
use Psalm\Tests\Provider;
class CorrectMethodTest extends \Psalm\Tests\TestCase
class AnalyzedMethodTest extends \Psalm\Tests\TestCase
{
/**
* @return void
@ -55,8 +55,8 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
public function testValidInclude(
array $start_files,
array $end_files,
array $initial_correct_methods,
array $unaffected_correct_methods,
array $initial_analyzed_methods,
array $unaffected_analyzed_methods,
array $error_levels = []
) {
$test_name = $this->getTestName();
@ -82,13 +82,13 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
$codebase->scanFiles();
$this->assertSame([], $codebase->analyzer->getCorrectMethods());
$this->assertSame([], $codebase->analyzer->getAnalyzedMethods());
$codebase->analyzer->analyzeFiles($this->project_checker, 1, false);
$this->assertSame(
$initial_correct_methods,
$codebase->analyzer->getCorrectMethods()
$initial_analyzed_methods,
$codebase->analyzer->getAnalyzedMethods()
);
foreach ($end_files as $file_path => $contents) {
@ -105,8 +105,8 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
$codebase->analyzer->loadCachedResults($this->project_checker);
$this->assertSame(
$unaffected_correct_methods,
$codebase->analyzer->getCorrectMethods()
$unaffected_analyzed_methods,
$codebase->analyzer->getAnalyzedMethods()
);
}
@ -173,7 +173,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
public function noReturnType() {}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::foofoo' => 1,
'foo\a::barbar' => 1,
@ -184,7 +184,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
'foo\b::noreturntype' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::barbar' => 1
],
@ -240,13 +240,13 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
'foo\b::foo' => 1,
'foo\b::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
'foo\b::bar' => 1,
],
@ -295,13 +295,13 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
'foo\b::foo' => 1,
'foo\b::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
'foo\b::bar' => 1,
],
@ -350,13 +350,13 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
'foo\b::foo' => 1,
'foo\b::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
'foo\b::bar' => 1,
],
@ -403,13 +403,13 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
'foo\b::foo' => 1,
'foo\b::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [
'foo\b::bar' => 1,
],
@ -480,7 +480,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::barbar&foo\t::barbar' => 1,
'foo\a::foofoo' => 1,
@ -491,7 +491,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
'foo\b::noreturntype' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::barbar&foo\t::barbar' => 1,
],
@ -563,7 +563,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::barbar&foo\t::barbar' => 1,
'foo\a::foofoo' => 1,
@ -573,7 +573,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
'foo\b::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::barbar&foo\t::barbar' => 1, // this doesn't exist, so we don't care
],
@ -643,7 +643,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::barbar&foo\t::barbar' => 1,
'foo\a::foofoo' => 1,
@ -653,7 +653,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
'foo\b::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [],
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [],
]
@ -727,7 +727,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::barbar&foo\t::barbar' => 1,
'foo\a::bat&foo\t::bat' => 1,
@ -738,7 +738,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
'foo\b::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::bat&foo\t::bat' => 1,
],
@ -798,7 +798,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::barbar&foo\t::barbar' => 1,
],
@ -806,7 +806,7 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
'foo\b::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [],
getcwd() . DIRECTORY_SEPARATOR . 'B.php' => [],
]
@ -855,14 +855,14 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::__construct' => 2,
'foo\a::setfoo' => 1,
'foo\a::reallysetfoo' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::__construct' => 2,
'foo\a::setfoo' => 1,
@ -913,14 +913,14 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::__construct' => 2,
'foo\a::setfoo' => 1,
'foo\a::reallysetfoo' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::setfoo' => 1,
],
@ -973,13 +973,13 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::setfoo&foo\t::setfoo' => 1,
'foo\a::__construct' => 2,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [],
]
],
@ -1014,13 +1014,13 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::__construct' => 2,
'foo\a::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
],
],
@ -1061,13 +1061,13 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::__construct' => 1,
'foo\a::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
],
]
@ -1103,14 +1103,16 @@ class CorrectMethodTest extends \Psalm\Tests\TestCase
}
}',
],
'initial_correct_methods' => [
'initial_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::__construct' => 1,
'foo\a::bar' => 1,
],
],
'unaffected_correct_methods' => [
'unaffected_analyzed_methods' => [
getcwd() . DIRECTORY_SEPARATOR . 'A.php' => [
'foo\a::__construct' => 1,
'foo\a::bar' => 1,
],
]
],

View File

@ -88,7 +88,7 @@ class FakeFileReferenceCacheProvider extends \Psalm\Provider\FileReferenceCacheP
/**
* @return array<string, array<string, int>>
*/
public function getCorrectMethodCache()
public function getAnalyzedMethodCache()
{
return $this->cached_correct_methods;
}
@ -97,7 +97,7 @@ class FakeFileReferenceCacheProvider extends \Psalm\Provider\FileReferenceCacheP
* @param array<string, array<string, int>> $correct_methods
* @return void
*/
public function setCorrectMethodCache(array $correct_methods)
public function setAnalyzedMethodCache(array $correct_methods)
{
$this->cached_correct_methods = $correct_methods;
}