1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Do not investigate null types

This commit is contained in:
Matthew Brown 2016-08-22 19:29:06 -04:00
parent a4a1fd9557
commit 2cba7a83bf

View File

@ -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