Skip to content

Commit

Permalink
[TypeProvider] Provide argument types during FunctionParamsProviderEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
veewee committed Jan 14, 2022
1 parent 90b330f commit 80abcd9
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Expand Up @@ -1119,6 +1119,7 @@ private static function evaluateArbitraryParam(
|| $arg->value instanceof PhpParser\Node\Expr\PostDec
|| $arg->value instanceof PhpParser\Node\Expr\PreInc
|| $arg->value instanceof PhpParser\Node\Expr\PreDec
|| $arg->value instanceof PhpParser\Node\Expr\ArrowFunction
) {
$was_inside_call = $context->inside_call;
$context->inside_call = true;
Expand Down
Expand Up @@ -484,30 +484,32 @@ private static function handleNamedFunction(
$is_maybe_root_function = !$function_name instanceof PhpParser\Node\Name\FullyQualified
&& count($function_name->parts) === 1;

$args = $stmt->isFirstClassCallable() ? [] : $stmt->getArgs();

if (!$function_call_info->in_call_map) {
$predefined_functions = $codebase->config->getPredefinedFunctions();
$is_predefined = isset($predefined_functions[strtolower($original_function_id)])
|| isset($predefined_functions[strtolower($function_call_info->function_id)]);

if ($context->check_functions) {
if (self::checkFunctionExists(
$statements_analyzer,
$function_call_info->function_id,
$code_location,
$is_maybe_root_function
) === false
) {
if (ArgumentsAnalyzer::analyze(
if (ArgumentsAnalyzer::analyze(
$statements_analyzer,
$stmt->getArgs(),
$args,
null,
null,
true,
$context
) === false) {
// fall through
}
// fall through
}

if (self::checkFunctionExists(
$statements_analyzer,
$function_call_info->function_id,
$code_location,
$is_maybe_root_function
) === false
) {
return $function_call_info;
}

Expand All @@ -520,7 +522,6 @@ private static function handleNamedFunction(
$function_call_info->function_params = null;
$function_call_info->defined_constants = [];
$function_call_info->global_variables = [];
$args = $stmt->isFirstClassCallable() ? [] : $stmt->getArgs();

if ($function_call_info->function_exists) {
if ($codebase->functions->params_provider->has($function_call_info->function_id)) {
Expand Down

0 comments on commit 80abcd9

Please sign in to comment.