1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

Fix "Could not get class storage" from cache (#3769)

Fixes #3671

This is better than an uncaught exception, at least, and I can detect
new issues if the constructor body changes
This commit is contained in:
Tyson Andre 2020-07-07 17:10:51 -04:00 committed by GitHub
parent 8ecee6df6d
commit cda6bd0553
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -6,6 +6,7 @@ use function array_intersect_key;
use function array_merge;
use function count;
use function explode;
use InvalidArgumentException;
use function number_format;
use function pathinfo;
use PhpParser;
@ -669,9 +670,15 @@ class Analyzer
if ($referencing_base_classlike === $unchanged_signature_classlike) {
$newly_invalidated_methods[$referencing_method_id] = true;
} else {
$referencing_storage = $codebase->classlike_storage_provider->get(
$referencing_base_classlike
);
try {
$referencing_storage = $codebase->classlike_storage_provider->get(
$referencing_base_classlike
);
} catch (InvalidArgumentException $_) {
// Workaround for #3671
$newly_invalidated_methods[$referencing_method_id] = true;
$referencing_storage = null;
}
if (isset($referencing_storage->used_traits[$unchanged_signature_classlike])
|| isset($referencing_storage->parent_classes[$unchanged_signature_classlike])