Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Dec 29, 2022
1 parent 44c2fd5 commit 89e4b16
Showing 1 changed file with 3 additions and 5 deletions.
Expand Up @@ -241,9 +241,8 @@ public static function verifyReturnType(
}

$inferred_return_type_parts_with_never = $inferred_return_type_parts;
$number_of_types = count($inferred_return_type_parts);
// we filter TNever that have no bearing on the return type
if ($number_of_types > 1) {
if (count($inferred_return_type_parts) > 1) {
$inferred_return_type_parts = array_filter(
$inferred_return_type_parts,
static fn(Union $union_type): bool => !$union_type->isNever()
Expand All @@ -260,7 +259,7 @@ public static function verifyReturnType(
}

// void + never = null, so we need to check this separately
if ($number_of_types > 1
if (count($inferred_return_type_parts_with_never) > 1
&& !$function_always_exits
&& $inferred_return_type_parts_with_never !== $inferred_return_type_parts) {
$inferred_return_type_with_never = Type::combineUnionTypeArray(
Expand Down Expand Up @@ -614,8 +613,7 @@ public static function verifyReturnType(
return false;
}
}
} elseif (
($declared_return_type->explicit_never === false || !$declared_return_type->isNull())
} elseif (($declared_return_type->explicit_never === false || !$declared_return_type->isNull())
&& (
!$declared_return_type->isNullable()
|| ($parent_class === null && $self_fq_class_name === $source->getFQCLN())
Expand Down

0 comments on commit 89e4b16

Please sign in to comment.