From c61763d7e56a0259a1750acab5f3a91024b480b2 Mon Sep 17 00:00:00 2001 From: lmoelleken Date: Wed, 27 Oct 2021 23:29:56 +0200 Subject: [PATCH] faster `TypeCombinator::remove()` --- src/Type/TypeCombinator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Type/TypeCombinator.php b/src/Type/TypeCombinator.php index 42b3a0b7ac..fb1f41e7a7 100644 --- a/src/Type/TypeCombinator.php +++ b/src/Type/TypeCombinator.php @@ -95,7 +95,7 @@ public static function remove(Type $fromType, Type $typeToRemove): Type $lowerPart = $removeValueMin !== null ? IntegerRangeType::fromInterval(null, $removeValueMin, -1) : null; $upperPart = $removeValueMax !== null ? IntegerRangeType::fromInterval($removeValueMax, null, +1) : null; if ($lowerPart !== null && $upperPart !== null) { - return self::union($lowerPart, $upperPart); + return new UnionType([$lowerPart, $upperPart]); } return $lowerPart ?? $upperPart ?? new NeverType(); }