mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Fix #223 - array_map with too few args should have issue
This commit is contained in:
parent
6b4bd47ddb
commit
483b4c75f3
@ -1820,6 +1820,28 @@ class CallChecker
|
||||
}
|
||||
|
||||
if ($method_id === 'array_map' || $method_id === 'array_filter') {
|
||||
if ($method_id === 'array_map' && count($args) < 2) {
|
||||
if (IssueBuffer::accepts(
|
||||
new TooFewArguments(
|
||||
'Too few arguments for ' . $method_id,
|
||||
$code_location
|
||||
),
|
||||
$statements_checker->getSuppressedIssues()
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
} elseif ($method_id === 'array_filter' && count($args) < 1) {
|
||||
if (IssueBuffer::accepts(
|
||||
new TooFewArguments(
|
||||
'Too few arguments for ' . $method_id,
|
||||
$code_location
|
||||
),
|
||||
$statements_checker->getSuppressedIssues()
|
||||
)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (self::checkArrayFunctionArgumentsMatch(
|
||||
$statements_checker,
|
||||
$args,
|
||||
|
Loading…
Reference in New Issue
Block a user