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

Invalidate cached methods when referenced files are deleted

This commit is contained in:
Tinjo Schöni 2023-06-20 00:13:13 +02:00
parent 474f8874f0
commit 1161edfa33
No known key found for this signature in database
GPG Key ID: D6715103428615C4

View File

@ -687,6 +687,16 @@ class Analyzer
}
}
// This could be optimized by storing method references to files
foreach ($file_reference_provider->getDeletedReferencedFiles() as $deleted_file) {
foreach ($file_reference_provider->getFilesReferencingFile($deleted_file) as $file_referencing_deleted) {
$methods_referencing_deleted = $this->analyzed_methods[$file_referencing_deleted] ?? [];
foreach ($methods_referencing_deleted as $method_referencing_deleted => $_) {
$newly_invalidated_methods[$method_referencing_deleted] = true;
}
}
}
foreach ($newly_invalidated_methods as $method_id => $_) {
foreach ($method_references_to_class_members as $i => $_) {
unset($method_references_to_class_members[$i][$method_id]);