1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-21 21:31:13 +01:00

Fix redundant condition

This commit is contained in:
Brown 2020-07-01 19:31:10 -04:00
parent 6c62e46d15
commit 0f548c83ea

View File

@ -483,6 +483,10 @@ class ArrayFunctionArgumentsAnalyzer
$codebase = $statements_analyzer->getCodebase();
if (!$closure_type instanceof Type\Atomic\TFn) {
if ($method_id === 'array_map') {
return;
}
if (!$closure_arg->value instanceof PhpParser\Node\Scalar\String_
&& !$closure_arg->value instanceof PhpParser\Node\Expr\Array_
&& !$closure_arg->value instanceof PhpParser\Node\Expr\BinaryOp\Concat
@ -700,11 +704,6 @@ class ArrayFunctionArgumentsAnalyzer
return;
}
// we pick up errors for string closures elsewhere
if ($method_id === 'array_map' && $closure_type instanceof Type\Atomic\TString) {
return;
}
foreach ($closure_params as $i => $closure_param) {
if (!isset($array_arg_types[$i])) {
continue;