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

Fix templated return types in traits

This commit is contained in:
Matt Brown 2017-11-02 15:07:39 -04:00
parent aeb9882281
commit b163c296ff

View File

@ -1487,9 +1487,26 @@ class CallChecker
list($fq_class_name, $method_name) = explode('::', $method_id);
$class_storage = $project_checker->classlike_storage_provider->get($fq_class_name);
$method_storage = isset($class_storage->methods[strtolower($method_name)])
? $class_storage->methods[strtolower($method_name)]
: null;
$method_storage = null;
if (isset($class_storage->declaring_method_ids[strtolower($method_name)])) {
$declaring_method_id = $class_storage->declaring_method_ids[strtolower($method_name)];
list($declaring_fq_class_name, $declaring_method_name) = explode('::', $declaring_method_id);
if ($declaring_fq_class_name !== $fq_class_name) {
$declaring_class_storage = $project_checker->classlike_storage_provider->get($declaring_fq_class_name);
} else {
$declaring_class_storage = $class_storage;
}
if (!isset($declaring_class_storage->methods[strtolower($declaring_method_name)])) {
throw new \UnexpectedValueException('Storage should not be empty here');
}
$method_storage = $declaring_class_storage->methods[strtolower($declaring_method_name)];
}
if (!$class_storage->user_defined) {
// check again after we've processed args