1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

Fixing a crash if a method or property does not exist

This commit is contained in:
Ivan Sidorov 2023-11-17 14:38:45 +00:00
parent e677523843
commit 88c98ef333

View File

@ -1899,7 +1899,11 @@ final class Codebase
$method_storages = [];
foreach ($class_storage->declaring_method_ids as $declaring_method_id) {
try {
$method_storages[] = $this->methods->getStorage($declaring_method_id);
} catch (UnexpectedValueException $e) {
error_log($e->getMessage());
}
}
if ($gap === '->') {
$method_storages += $class_storage->pseudo_methods;
@ -1970,9 +1974,14 @@ final class Codebase
}
foreach ($class_storage->declaring_property_ids as $property_name => $declaring_class) {
try {
$property_storage = $this->properties->getStorage(
$declaring_class . '::$' . $property_name,
);
} catch (UnexpectedValueException $e) {
error_log($e->getMessage());
continue;
}
if (!in_array($property_storage->visibility, $allow_visibilities)) {
continue;