Skip to content

Commit

Permalink
Faster ObjectType->getEnumCases()
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Jul 2, 2024
1 parent 579402b commit 4785a7e
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Type/ObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -1235,9 +1235,10 @@ public function getEnumCases(): array
}

if ($this->subtractedType !== null) {
$subtracedEnumCases = $this->subtractedType->getEnumCases();
foreach ($cases as $i => $case) {
$caseName = $case->getEnumCaseName();
foreach ($this->subtractedType->getEnumCases() as $subtracedCase) {
foreach ($subtracedEnumCases as $subtracedCase) {
if ($caseName === $subtracedCase->getEnumCaseName()) {
unset($cases[$i]);
continue 2;
Expand Down

0 comments on commit 4785a7e

Please sign in to comment.