diff --git a/src/Psalm/Internal/Codebase/ClassLikes.php b/src/Psalm/Internal/Codebase/ClassLikes.php index 552fab265d5..a68703a5488 100644 --- a/src/Psalm/Internal/Codebase/ClassLikes.php +++ b/src/Psalm/Internal/Codebase/ClassLikes.php @@ -613,6 +613,9 @@ public function classExtends(string $fq_class_name, string $possible_parent, boo return false; } + if (!$this->classlike_storage_provider->has($unaliased_fq_class_name)) { + return false; + } $class_storage = $this->classlike_storage_provider->get($unaliased_fq_class_name); if ($from_api && !$class_storage->populated) { @@ -722,7 +725,9 @@ public function interfaceExtends(string $interface_name, string $possible_parent public function getParentInterfaces(string $fq_interface_name): array { $fq_interface_name = strtolower($fq_interface_name); - + if (!$this->classlike_storage_provider->has($fq_interface_name)) { + return []; + } return $this->classlike_storage_provider->get($fq_interface_name)->parent_interfaces; }