Skip to content
Permalink
Browse files

Refine callable type

  • Loading branch information
muglug committed Dec 14, 2019
1 parent c3d8315 commit c7a3ba9e4a39f22d17d8014845998342b9d95445
@@ -149,12 +149,14 @@ public static function analyze(

$function_exists = true;
$has_valid_function_call_type = true;
} elseif ($var_type_part instanceof TTemplateParam && $var_type_part->as->hasCallableType()) {
$has_valid_function_call_type = true;
} elseif ($var_type_part instanceof TMixed || $var_type_part instanceof TTemplateParam) {
$has_valid_function_call_type = true;

if (IssueBuffer::accepts(
new MixedFunctionCall(
'Cannot call function on mixed',
'Cannot call function on ' . $var_type_part->getId(),
new CodeLocation($statements_analyzer->getSource(), $stmt)
),
$statements_analyzer->getSuppressedIssues()
@@ -1940,6 +1940,10 @@ private static function reconcileCallable(
$callable_types[] = $type;
$did_remove_type = true;
} elseif ($type instanceof TTemplateParam) {
if ($type->as->isMixed()) {
$type = clone $type;
$type->as = new Type\Union([new Type\Atomic\TCallable]);
}
$callable_types[] = $type;
$did_remove_type = true;
} else {

0 comments on commit c7a3ba9

Please sign in to comment.
You can’t perform that action at this time.