mirror of
https://github.com/danog/psalm.git
synced 2025-01-21 21:31:13 +01:00
Fix cache growth thanks to array_recursive
This commit is contained in:
parent
09cf864d9b
commit
5918278af3
@ -4,7 +4,6 @@ namespace Psalm\Internal\Codebase;
|
||||
use function array_filter;
|
||||
use function array_intersect_key;
|
||||
use function array_merge;
|
||||
use function array_merge_recursive;
|
||||
use function count;
|
||||
use function explode;
|
||||
use function number_format;
|
||||
@ -998,7 +997,16 @@ class Analyzer
|
||||
*/
|
||||
public function addMixedMemberNames(array $names)
|
||||
{
|
||||
$this->mixed_member_names = array_merge_recursive($this->mixed_member_names, $names);
|
||||
foreach ($names as $key => $name) {
|
||||
if (isset($this->mixed_member_names[$key])) {
|
||||
$this->mixed_member_names[$key] = array_merge(
|
||||
$this->mixed_member_names[$key],
|
||||
$name
|
||||
);
|
||||
} else {
|
||||
$this->mixed_member_names[$key] = $name;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -4,7 +4,6 @@ namespace Psalm\Internal\Provider;
|
||||
use function array_filter;
|
||||
use function array_keys;
|
||||
use function array_merge;
|
||||
use function array_merge_recursive;
|
||||
use function array_unique;
|
||||
use function file_exists;
|
||||
use Psalm\Codebase;
|
||||
@ -207,10 +206,16 @@ class FileReferenceProvider
|
||||
*/
|
||||
public function addFileReferencesToClasses(array $references)
|
||||
{
|
||||
self::$file_references_to_classes = array_merge_recursive(
|
||||
$references,
|
||||
self::$file_references_to_classes
|
||||
);
|
||||
foreach ($references as $key => $reference) {
|
||||
if (isset(self::$file_references_to_classes[$key])) {
|
||||
self::$file_references_to_classes[$key] = array_merge(
|
||||
$reference,
|
||||
self::$file_references_to_classes[$key]
|
||||
);
|
||||
} else {
|
||||
self::$file_references_to_classes[$key] = $reference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -252,10 +257,16 @@ class FileReferenceProvider
|
||||
*/
|
||||
public function addFileReferencesToClassMembers(array $references)
|
||||
{
|
||||
self::$file_references_to_class_members = array_merge_recursive(
|
||||
$references,
|
||||
self::$file_references_to_class_members
|
||||
);
|
||||
foreach ($references as $key => $reference) {
|
||||
if (isset(self::$file_references_to_class_members[$key])) {
|
||||
self::$file_references_to_class_members[$key] = array_merge(
|
||||
$reference,
|
||||
self::$file_references_to_class_members[$key]
|
||||
);
|
||||
} else {
|
||||
self::$file_references_to_class_members[$key] = $reference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -265,10 +276,16 @@ class FileReferenceProvider
|
||||
*/
|
||||
public function addFileReferencesToMissingClassMembers(array $references)
|
||||
{
|
||||
self::$file_references_to_missing_class_members = array_merge_recursive(
|
||||
$references,
|
||||
self::$file_references_to_missing_class_members
|
||||
);
|
||||
foreach ($references as $key => $reference) {
|
||||
if (isset(self::$file_references_to_missing_class_members[$key])) {
|
||||
self::$file_references_to_missing_class_members[$key] = array_merge(
|
||||
$reference,
|
||||
self::$file_references_to_missing_class_members[$key]
|
||||
);
|
||||
} else {
|
||||
self::$file_references_to_missing_class_members[$key] = $reference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -704,10 +721,16 @@ class FileReferenceProvider
|
||||
*/
|
||||
public function addMethodReferencesToClassMembers(array $references)
|
||||
{
|
||||
self::$method_references_to_class_members = array_merge_recursive(
|
||||
$references,
|
||||
self::$method_references_to_class_members
|
||||
);
|
||||
foreach ($references as $key => $reference) {
|
||||
if (isset(self::$method_references_to_class_members[$key])) {
|
||||
self::$method_references_to_class_members[$key] = array_merge(
|
||||
$reference,
|
||||
self::$method_references_to_class_members[$key]
|
||||
);
|
||||
} else {
|
||||
self::$method_references_to_class_members[$key] = $reference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -717,10 +740,16 @@ class FileReferenceProvider
|
||||
*/
|
||||
public function addMethodReferencesToMissingClassMembers(array $references)
|
||||
{
|
||||
self::$method_references_to_missing_class_members = array_merge_recursive(
|
||||
$references,
|
||||
self::$method_references_to_missing_class_members
|
||||
);
|
||||
foreach ($references as $key => $reference) {
|
||||
if (isset(self::$method_references_to_missing_class_members[$key])) {
|
||||
self::$method_references_to_missing_class_members[$key] = array_merge(
|
||||
$reference,
|
||||
self::$method_references_to_missing_class_members[$key]
|
||||
);
|
||||
} else {
|
||||
self::$method_references_to_missing_class_members[$key] = $reference;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user