1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Throw exception if function doesn’t exist

This commit is contained in:
Matthew Brown 2018-03-03 16:52:48 -05:00
parent ecef628e21
commit 3b48f43fdc

View File

@ -777,7 +777,11 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
try {
return $codebase_methods->getStorage($method_id);
} catch (\UnexpectedValueException $e) {
$declaring_method_id = (string) $codebase_methods->getDeclaringMethodId($method_id);
$declaring_method_id = $codebase_methods->getDeclaringMethodId($method_id);
if (!$declaring_method_id) {
throw new \UnexpectedValueException('Cannot get storage for function that doesnt exist');
}
// happens for fake constructors
return $codebase_methods->getStorage($declaring_method_id);