Skip to content

Commit

Permalink
Simplification again
Browse files Browse the repository at this point in the history
  • Loading branch information
ondrejmirtes committed Dec 20, 2022
1 parent 1b5f5e4 commit 93a9227
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Rules/RuleLevelHelper.php
Expand Up @@ -114,7 +114,10 @@ public function accepts(Type $acceptingType, Type $acceptedType, bool $strictTyp
}

$accepts = $acceptingType->accepts($acceptedType, $strictTypes);
if (!$accepts->yes() && $acceptingType instanceof UnionType) {
if (!$accepts->maybe()) {
return $accepts->yes();
}
if ($acceptingType instanceof UnionType) {
foreach ($acceptingType->getTypes() as $innerType) {
if (self::accepts($innerType, $acceptedType, $strictTypes)) {
return true;
Expand Down

0 comments on commit 93a9227

Please sign in to comment.