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

Return false in fewer places

This commit is contained in:
Matthew Brown 2019-06-30 12:06:49 -04:00
parent 220fa31404
commit 0e8fa0e73e

View File

@ -1175,7 +1175,7 @@ class CallAnalyzer
$generic_params,
$template_types
) === false) {
return false;
return;
}
}
@ -1206,7 +1206,7 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
} elseif ($method_id === 'array_filter' && count($args) < 1) {
if (IssueBuffer::accepts(
@ -1217,7 +1217,7 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
}
@ -1230,6 +1230,8 @@ class CallAnalyzer
) {
return false;
}
return null;
}
if (!$is_variadic
@ -1279,7 +1281,7 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
break;
@ -1442,10 +1444,10 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
return;
return false;
}
if (!in_array(
@ -1693,8 +1695,10 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
continue;
}
}
@ -1848,7 +1852,7 @@ class CallAnalyzer
}
foreach ($closure_arg_type->getTypes() as $closure_type) {
if (self::checkArrayFunctionClosureType(
self::checkArrayFunctionClosureType(
$statements_analyzer,
$method_id,
$closure_type,
@ -1857,9 +1861,7 @@ class CallAnalyzer
$max_closure_param_count,
$array_arg_types,
$check_functions
) === false) {
return false;
}
);
}
}
}
@ -1870,7 +1872,7 @@ class CallAnalyzer
* @param int $max_closure_param_count [description]
* @param (TArray|null)[] $array_arg_types
*
* @return false|null
* @return void
*/
private static function checkArrayFunctionClosureType(
StatementsAnalyzer $statements_analyzer,
@ -2008,7 +2010,7 @@ class CallAnalyzer
continue;
}
if (self::checkArrayFunctionClosureTypeArgs(
self::checkArrayFunctionClosureTypeArgs(
$statements_analyzer,
$method_id,
$closure_type,
@ -2016,9 +2018,7 @@ class CallAnalyzer
$min_closure_param_count,
$max_closure_param_count,
$array_arg_types
) === false) {
return false;
}
);
}
}
@ -2029,7 +2029,7 @@ class CallAnalyzer
* @param int $max_closure_param_count
* @param (TArray|null)[] $array_arg_types
*
* @return false|null
* @return void
*/
private static function checkArrayFunctionClosureTypeArgs(
StatementsAnalyzer $statements_analyzer,
@ -2068,8 +2068,10 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
return;
} elseif ($required_param_count > $max_closure_param_count) {
$argument_text = $max_closure_param_count === 1 ? 'one argument' : $max_closure_param_count . ' arguments';
@ -2082,8 +2084,10 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
return;
}
// abandon attempt to validate closure params if we have an extra arg for ARRAY_FILTER
@ -2196,7 +2200,7 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
}
@ -2313,7 +2317,7 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
return null;
@ -2503,7 +2507,7 @@ class CallAnalyzer
$statements_analyzer->getSuppressedIssues()
) === false
) {
return false;
return;
}
} elseif ($param_type_part instanceof TArray
&& $input_expr instanceof PhpParser\Node\Expr\Array_
@ -2519,7 +2523,7 @@ class CallAnalyzer
$statements_analyzer->getSuppressedIssues()
) === false
) {
return false;
return;
}
}
}
@ -2567,7 +2571,7 @@ class CallAnalyzer
$statements_analyzer->getSuppressedIssues()
) === false
) {
return false;
return;
}
if (!$codebase->classOrInterfaceExists($callable_fq_class_name)) {
@ -2591,7 +2595,7 @@ class CallAnalyzer
$statements_analyzer->getSuppressedIssues()
) === false
) {
return false;
return;
}
}
} else {
@ -2602,7 +2606,7 @@ class CallAnalyzer
false
) === false
) {
return false;
return;
}
}
}
@ -2621,7 +2625,7 @@ class CallAnalyzer
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
return null;