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:
parent
c11b32d414
commit
ddf74919f6
@ -26,16 +26,13 @@ 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);
|
|
||||||
$file_storage->referenced_classlikes[strtolower($fq_type_string)] = $fq_type_string;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$codebase->scanner->queueClassLikeForScanning($fq_type_string);
|
||||||
|
$file_storage->referenced_classlikes[strtolower($fq_type_string)] = $fq_type_string;
|
||||||
|
|
||||||
$args = [];
|
$args = [];
|
||||||
|
|
||||||
foreach ($stmt->args as $arg_node) {
|
foreach ($stmt->args as $arg_node) {
|
||||||
|
@ -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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user