mirror of
https://github.com/danog/psalm.git
synced 2024-11-26 20:34:47 +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
7cc512c9dc
commit
35fc84cdbb
@ -524,11 +524,11 @@ class FunctionLikeNodeScanner
|
|||||||
&& $function_stmt->expr->expr instanceof PhpParser\Node\Expr\FuncCall
|
&& $function_stmt->expr->expr instanceof PhpParser\Node\Expr\FuncCall
|
||||||
&& $function_stmt->expr->expr->name instanceof PhpParser\Node\Name
|
&& $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'
|
if ($inner_function_id === 'func_get_arg'
|
||||||
|| $function_id === 'func_get_args'
|
|| $inner_function_id === 'func_get_args'
|
||||||
|| $function_id === 'func_num_args'
|
|| $inner_function_id === 'func_num_args'
|
||||||
) {
|
) {
|
||||||
$storage->variadic = true;
|
$storage->variadic = true;
|
||||||
}
|
}
|
||||||
@ -538,11 +538,11 @@ class FunctionLikeNodeScanner
|
|||||||
&& $function_stmt->cond->left->left instanceof PhpParser\Node\Expr\FuncCall
|
&& $function_stmt->cond->left->left instanceof PhpParser\Node\Expr\FuncCall
|
||||||
&& $function_stmt->cond->left->left->name instanceof PhpParser\Node\Name
|
&& $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'
|
if ($inner_function_id === 'func_get_arg'
|
||||||
|| $function_id === 'func_get_args'
|
|| $inner_function_id === 'func_get_args'
|
||||||
|| $function_id === 'func_num_args'
|
|| $inner_function_id === 'func_num_args'
|
||||||
) {
|
) {
|
||||||
$storage->variadic = true;
|
$storage->variadic = true;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user