mirror of
https://github.com/danog/psalm.git
synced 2025-01-22 05:41:20 +01:00
Fix #587 - scan all functions for func_get_args
This commit is contained in:
parent
c17c3bd5bf
commit
95b5f205c4
@ -762,6 +762,29 @@ class DependencyFinderVisitor extends PhpParser\NodeVisitorAbstract implements P
|
||||
$storage->assertions = $var_assertions;
|
||||
}
|
||||
|
||||
if (!$this->scan_deep
|
||||
&& ($stmt instanceof PhpParser\Node\Stmt\Function_
|
||||
|| $stmt instanceof PhpParser\Node\Stmt\ClassMethod
|
||||
|| $stmt instanceof PhpParser\Node\Expr\Closure)
|
||||
&& $stmt->stmts
|
||||
) {
|
||||
// pick up func_get_args that would otherwise be missed
|
||||
foreach ($stmt->stmts as $function_stmt) {
|
||||
if ($function_stmt instanceof PhpParser\Node\Expr\FuncCall
|
||||
&& $function_stmt->name instanceof PhpParser\Node\Name
|
||||
) {
|
||||
$function_id = implode('\\', $function_stmt->name->parts);
|
||||
|
||||
if ($function_id === 'func_get_arg'
|
||||
|| $function_id === 'func_get_args'
|
||||
|| $function_id === 'func_num_args'
|
||||
) {
|
||||
$storage->variadic = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @psalm-suppress MixedAssignment
|
||||
*
|
||||
|
Loading…
x
Reference in New Issue
Block a user