mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix functions being resolved to other functions (#4793)
Fixes #4750 Reusing the $function_id variable causes an incorrect global function to be added at line 654
This commit is contained in:
parent
cd576f8e02
commit
7fe8e5a1cf
@ -524,11 +524,11 @@ class FunctionLikeNodeScanner
|
||||
&& $function_stmt->expr->expr instanceof PhpParser\Node\Expr\FuncCall
|
||||
&& $function_stmt->expr->expr->name instanceof PhpParser\Node\Name
|
||||
) {
|
||||
$function_id = implode('\\', $function_stmt->expr->expr->name->parts);
|
||||
$inner_function_id = implode('\\', $function_stmt->expr->expr->name->parts);
|
||||
|
||||
if ($function_id === 'func_get_arg'
|
||||
|| $function_id === 'func_get_args'
|
||||
|| $function_id === 'func_num_args'
|
||||
if ($inner_function_id === 'func_get_arg'
|
||||
|| $inner_function_id === 'func_get_args'
|
||||
|| $inner_function_id === 'func_num_args'
|
||||
) {
|
||||
$storage->variadic = true;
|
||||
}
|
||||
@ -538,11 +538,11 @@ class FunctionLikeNodeScanner
|
||||
&& $function_stmt->cond->left->left instanceof PhpParser\Node\Expr\FuncCall
|
||||
&& $function_stmt->cond->left->left->name instanceof PhpParser\Node\Name
|
||||
) {
|
||||
$function_id = implode('\\', $function_stmt->cond->left->left->name->parts);
|
||||
$inner_function_id = implode('\\', $function_stmt->cond->left->left->name->parts);
|
||||
|
||||
if ($function_id === 'func_get_arg'
|
||||
|| $function_id === 'func_get_args'
|
||||
|| $function_id === 'func_num_args'
|
||||
if ($inner_function_id === 'func_get_arg'
|
||||
|| $inner_function_id === 'func_get_args'
|
||||
|| $inner_function_id === 'func_num_args'
|
||||
) {
|
||||
$storage->variadic = true;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user