Skip to content

Commit

Permalink
Another try
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Apr 29, 2024
1 parent a184f15 commit eabe01e
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions src/Psalm/Internal/Type/TemplateInferredTypeReplacer.php
Original file line number Diff line number Diff line change
Expand Up @@ -442,23 +442,21 @@ private static function replaceConditional(
|| $conditional_type->getId() !== 'float')
) {
$matching_if_types[] = $candidate_atomic_type;
} elseif (!UnionTypeComparator::isContainedBy(
$codebase,
$conditional_type,
new Union([$candidate_atomic_type]),
false,
false,
null,
false,
false,
) && null === Type::intersectUnionTypes(
new Union([$candidate_atomic_type]),
$conditional_type,
$codebase,
false,
false,
)) {
$matching_else_types[] = $candidate_atomic_type;
} else {
$intersection = Type::intersectUnionTypes(
new Union([$candidate_atomic_type]),
$conditional_type,
$codebase,
false,
false,
);

if (null === $intersection) {
$matching_else_types[] = $candidate_atomic_type;
} else {
$matching_if_types[] = $candidate_atomic_type;
$matching_else_types[] = $candidate_atomic_type;
}
}
}

Expand Down

0 comments on commit eabe01e

Please sign in to comment.