1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 22:01:48 +01:00

Prevent callable arg type enhancement for simple callable

This commit is contained in:
andrew 2023-04-06 10:43:50 +03:00
parent d190b751fb
commit 0456ef82a5
2 changed files with 9 additions and 0 deletions

View File

@ -78,6 +78,10 @@ final class HighOrderFunctionArgHandler
HighOrderFunctionArgInfo $high_order_callable_info,
?TemplateResult $high_order_template_result
): void {
if ($high_order_callable_info->getType() === HighOrderFunctionArgInfo::TYPE_CALLABLE) {
return;
}
$statements_analyzer->node_data->setType($arg_expr, TemplateInferredTypeReplacer::replace(
$high_order_callable_info->getFunctionType(),
$high_order_template_result ?? new TemplateResult([], []),

View File

@ -54,6 +54,11 @@ final class HighOrderFunctionArgInfo
return new TemplateResult($templates, []);
}
public function getType(): string
{
return $this->type;
}
public function getFunctionType(): Union
{
switch ($this->type) {