Skip to content
Permalink
Browse files

Return false in fewer places

  • Loading branch information...
muglug committed Jun 30, 2019
1 parent 220fa31 commit 0e8fa0e73e3e4530ed88d457194689eabec9b905
Showing with 31 additions and 27 deletions.
  1. +31 −27 src/Psalm/Internal/Analyzer/Statements/Expression/CallAnalyzer.php
@@ -1175,7 +1175,7 @@ protected static function checkFunctionLikeArgumentsMatch(
$generic_params,
$template_types
) === false) {
return false;
return;
}
}
@@ -1206,7 +1206,7 @@ protected static function checkFunctionLikeArgumentsMatch(
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
} elseif ($method_id === 'array_filter' && count($args) < 1) {
if (IssueBuffer::accepts(
@@ -1217,7 +1217,7 @@ protected static function checkFunctionLikeArgumentsMatch(
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
}
@@ -1230,6 +1230,8 @@ protected static function checkFunctionLikeArgumentsMatch(
) {
return false;
}
return null;
}
if (!$is_variadic
@@ -1279,7 +1281,7 @@ protected static function checkFunctionLikeArgumentsMatch(
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
break;
@@ -1442,10 +1444,10 @@ private static function handlePossiblyMatchingByRefParam(
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
return;
return false;
}
if (!in_array(
@@ -1693,8 +1695,10 @@ private static function checkFunctionLikeTypeMatches(
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
continue;
}
}
@@ -1848,7 +1852,7 @@ protected static function checkArrayFunctionArgumentsMatch(
}
foreach ($closure_arg_type->getTypes() as $closure_type) {
if (self::checkArrayFunctionClosureType(
self::checkArrayFunctionClosureType(
$statements_analyzer,
$method_id,
$closure_type,
@@ -1857,9 +1861,7 @@ protected static function checkArrayFunctionArgumentsMatch(
$max_closure_param_count,
$array_arg_types,
$check_functions
) === false) {
return false;
}
);
}
}
}
@@ -1870,7 +1872,7 @@ protected static function checkArrayFunctionArgumentsMatch(
* @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,17 +2010,15 @@ private static function checkArrayFunctionClosureType(
continue;
}
if (self::checkArrayFunctionClosureTypeArgs(
self::checkArrayFunctionClosureTypeArgs(
$statements_analyzer,
$method_id,
$closure_type,
$closure_arg,
$min_closure_param_count,
$max_closure_param_count,
$array_arg_types
) === false) {
return false;
}
);
}
}
@@ -2029,7 +2029,7 @@ private static function checkArrayFunctionClosureType(
* @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 @@ private static function checkArrayFunctionClosureTypeArgs(
),
$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 @@ private static function checkArrayFunctionClosureTypeArgs(
),
$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 @@ private static function checkArrayFunctionClosureTypeArgs(
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
}
@@ -2313,7 +2317,7 @@ public static function checkFunctionArgumentType(
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
return null;
@@ -2503,7 +2507,7 @@ public static function checkFunctionArgumentType(
$statements_analyzer->getSuppressedIssues()
) === false
) {
return false;
return;
}
} elseif ($param_type_part instanceof TArray
&& $input_expr instanceof PhpParser\Node\Expr\Array_
@@ -2519,7 +2523,7 @@ public static function checkFunctionArgumentType(
$statements_analyzer->getSuppressedIssues()
) === false
) {
return false;
return;
}
}
}
@@ -2567,7 +2571,7 @@ public static function checkFunctionArgumentType(
$statements_analyzer->getSuppressedIssues()
) === false
) {
return false;
return;
}
if (!$codebase->classOrInterfaceExists($callable_fq_class_name)) {
@@ -2591,7 +2595,7 @@ public static function checkFunctionArgumentType(
$statements_analyzer->getSuppressedIssues()
) === false
) {
return false;
return;
}
}
} else {
@@ -2602,7 +2606,7 @@ public static function checkFunctionArgumentType(
false
) === false
) {
return false;
return;
}
}
}
@@ -2621,7 +2625,7 @@ public static function checkFunctionArgumentType(
),
$statements_analyzer->getSuppressedIssues()
)) {
return false;
// fall through
}
return null;

0 comments on commit 0e8fa0e

Please sign in to comment.
You can’t perform that action at this time.