From c4a222171ba82e6da2638b6c03b7846ff3bc0500 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Tue, 26 Jul 2016 14:58:45 -0400 Subject: [PATCH] Fix undefined var name --- src/Psalm/ClassMethodChecker.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/Psalm/ClassMethodChecker.php b/src/Psalm/ClassMethodChecker.php index 8556ddb85..66cfe099a 100644 --- a/src/Psalm/ClassMethodChecker.php +++ b/src/Psalm/ClassMethodChecker.php @@ -171,6 +171,10 @@ class ClassMethodChecker extends FunctionChecker } foreach ($declared_type->types as $key => $declared_atomic_type) { + if (!isset($inferred_type->types[$key])) { + continue; + } + $inferred_atomic_type = $inferred_type->types[$key]; if (!($declared_atomic_type instanceof Type\Generic)) { @@ -317,7 +321,7 @@ class ClassMethodChecker extends FunctionChecker foreach ($docblock_info['params'] as $docblock_param) { $docblock_param_name = $docblock_param['name']; - if (isset($method_param_names[$param_name])) { + if (isset($method_param_names[$docblock_param_name])) { foreach (self::$_method_params[$method_id] as &$param_info) { if ($param_info['name'] === $docblock_param_name) { $docblock_param_type_string = $docblock_param['type'];