1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00

fix errors

This commit is contained in:
orklah 2021-11-09 21:14:55 +01:00
parent db05dfeb4c
commit 21591b0f2a
2 changed files with 11 additions and 5 deletions

View File

@ -41,6 +41,7 @@ use Psalm\Type\Union;
use function array_diff;
use function array_filter;
use function array_values;
use function count;
use function in_array;
use function strpos;
@ -59,6 +60,7 @@ class ReturnTypeAnalyzer
* @return false|null
*
* @psalm-suppress PossiblyUnusedReturnValue unused but seems important
* @psalm-suppress ComplexMethod to be refactored
*/
public static function verifyReturnType(
FunctionLike $function,
@ -254,6 +256,8 @@ class ReturnTypeAnalyzer
}
}
$inferred_return_type_parts = array_values($inferred_return_type_parts);
$inferred_return_type = $inferred_return_type_parts
? \Psalm\Type::combineUnionTypeArray($inferred_return_type_parts, $codebase)
: Type::getVoid();

View File

@ -826,12 +826,14 @@ class TypeExpander
}
}
$combined = TypeCombiner::combine(
array_values($all_conditional_return_types),
$codebase
);
if ($all_conditional_return_types) {
$combined = TypeCombiner::combine(
array_values($all_conditional_return_types),
$codebase
);
return array_values($combined->getAtomicTypes());
return array_values($combined->getAtomicTypes());
}
}
$return_type->conditional_type = self::expandUnion(