From 2cba7a83bf627825631b8468cf49f00f016b79b3 Mon Sep 17 00:00:00 2001 From: Matthew Brown Date: Mon, 22 Aug 2016 19:29:06 -0400 Subject: [PATCH] Do not investigate null types --- src/Psalm/Checker/TypeChecker.php | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Psalm/Checker/TypeChecker.php b/src/Psalm/Checker/TypeChecker.php index ae742954a..35c440ff9 100644 --- a/src/Psalm/Checker/TypeChecker.php +++ b/src/Psalm/Checker/TypeChecker.php @@ -568,6 +568,11 @@ class TypeChecker $result_type = isset($existing_types[$key]) ? clone $existing_types[$key] : null; + if (!$result_type) { + $result_type = Type::getMixed(); + continue; + } + foreach ($new_type_parts as $new_type_part) { $result_type = self::reconcileTypes( (string) $new_type_part, @@ -607,14 +612,10 @@ class TypeChecker * @param int $line_number * @return Type\Union|false */ - public static function reconcileTypes($new_var_type, Type\Union $existing_var_type = null, $key = null, $file_name = null, $line_number = null, array $suppressed_issues = []) + public static function reconcileTypes($new_var_type, Type\Union $existing_var_type, $key = null, $file_name = null, $line_number = null, array $suppressed_issues = []) { $result_var_types = null; - if (!$existing_var_type) { - return Type::getMixed(); - } - if ($new_var_type === 'mixed' && $existing_var_type->isMixed()) { return $existing_var_type; } @@ -646,6 +647,7 @@ class TypeChecker if (empty($existing_var_type->types)) { if ($key) { + if (IssueBuffer::accepts( new FailedTypeResolution('Cannot resolve types for ' . $key, $file_name, $line_number), $suppressed_issues