1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 09:47:29 +01:00

if with common parts

This commit is contained in:
orklah 2021-09-26 22:32:00 +02:00
parent c11b32d414
commit ddf74919f6
3 changed files with 6 additions and 19 deletions

View File

@ -26,15 +26,12 @@ class AttributeResolver
) : AttributeStorage { ) : AttributeStorage {
if ($stmt->name instanceof PhpParser\Node\Name\FullyQualified) { if ($stmt->name instanceof PhpParser\Node\Name\FullyQualified) {
$fq_type_string = (string)$stmt->name; $fq_type_string = (string)$stmt->name;
$codebase->scanner->queueClassLikeForScanning($fq_type_string);
$file_storage->referenced_classlikes[strtolower($fq_type_string)] = $fq_type_string;
} else { } else {
$fq_type_string = ClassLikeAnalyzer::getFQCLNFromNameObject($stmt->name, $aliases); $fq_type_string = ClassLikeAnalyzer::getFQCLNFromNameObject($stmt->name, $aliases);
}
$codebase->scanner->queueClassLikeForScanning($fq_type_string); $codebase->scanner->queueClassLikeForScanning($fq_type_string);
$file_storage->referenced_classlikes[strtolower($fq_type_string)] = $fq_type_string; $file_storage->referenced_classlikes[strtolower($fq_type_string)] = $fq_type_string;
}
$args = []; $args = [];

View File

@ -258,11 +258,6 @@ class ArrayReduceReturnTypeProvider implements \Psalm\Plugin\EventHandler\Functi
$method_id, $method_id,
$self_class $self_class
) ?: Type::getMixed(); ) ?: Type::getMixed();
$reduce_return_type = Type::combineUnionTypes(
$reduce_return_type,
$return_type
);
} else { } else {
if (!$codebase->functions->functionExists( if (!$codebase->functions->functionExists(
$statements_source, $statements_source,
@ -280,12 +275,9 @@ class ArrayReduceReturnTypeProvider implements \Psalm\Plugin\EventHandler\Functi
); );
$return_type = $function_storage->return_type ?: Type::getMixed(); $return_type = $function_storage->return_type ?: Type::getMixed();
$reduce_return_type = Type::combineUnionTypes(
$reduce_return_type,
$return_type
);
} }
$reduce_return_type = Type::combineUnionTypes($reduce_return_type, $return_type);
} }
} }

View File

@ -402,10 +402,8 @@ class ParseTreeCreator
$this->current_leaf->parent = $new_leaf; $this->current_leaf->parent = $new_leaf;
array_pop($current_parent->children); array_pop($current_parent->children);
$current_parent->children[] = $new_leaf;
} else {
$current_parent->children[] = $new_leaf;
} }
$current_parent->children[] = $new_leaf;
$this->current_leaf = $new_leaf; $this->current_leaf = $new_leaf;
} }