1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Prevent template types from leaking when no generics are provided

This commit is contained in:
Matthew Brown 2017-02-12 19:26:23 -05:00
parent a87ea78efc
commit 1d09616e9d

View File

@ -725,7 +725,6 @@ class CallChecker
self::collectSpecialInformation($source, $stmt->name, $context);
}
if ($class_type_part instanceof TGenericObject) {
$class_storage = ClassLikeChecker::$storage[strtolower($fq_class_name)];
if ($class_storage->template_types) {
@ -734,7 +733,9 @@ class CallChecker
/** @var array<int, string> */
$reversed_class_template_types = array_reverse(array_keys($class_storage->template_types));
$provided_type_param_count = count($class_type_part->type_params);
$provided_type_param_count = $class_type_part instanceof TGenericObject
? count($class_type_part->type_params)
: 0;
foreach ($reversed_class_template_types as $i => $type_name) {
if (isset($class_type_part->type_params[$provided_type_param_count - 1 - $i])) {
@ -745,7 +746,6 @@ class CallChecker
}
}
}
}
if (self::checkMethodArgs(
$method_id,