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

Add exception for case that shouldn’t appear

This commit is contained in:
Matthew Brown 2018-07-03 08:09:00 -04:00
parent 5623aa1c19
commit ec1f7ba7be

View File

@ -218,7 +218,15 @@ abstract class FunctionLikeChecker extends SourceChecker implements StatementsSo
} elseif ($this->function instanceof Function_) {
$file_storage = $file_storage_provider->get($this->source->getFilePath());
$storage = $file_storage->functions[(string)$this->getMethodId()];
$function_id = (string)$this->getMethodId();
if (!isset($file_storage->functions[$function_id])) {
throw new \UnexpectedValueException(
'Function ' . $function_id . ' should be defined in ' . $this->source->getFilePath()
);
}
$storage = $file_storage->functions[$function_id];
$cased_method_id = $this->function->name;
} else { // Closure