Skip to content

Commit

Permalink
Fix typo in ObjectType
Browse files Browse the repository at this point in the history
  • Loading branch information
staabm committed Jul 2, 2024
1 parent 3a11805 commit 9b8ddcb
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions src/Type/ObjectType.php
Original file line number Diff line number Diff line change
Expand Up @@ -1230,15 +1230,15 @@ public function getEnumCases(): array
$className = $classReflection->getName();

if ($this->subtractedType !== null) {
$subtracedEnumCaseNames = [];
$subtractedEnumCaseNames = [];

foreach ($this->subtractedType->getEnumCases() as $subtractedCase) {
$subtracedEnumCaseNames[$subtractedCase->getEnumCaseName()] = true;
$subtractedEnumCaseNames[$subtractedCase->getEnumCaseName()] = true;
}

$cases = [];
foreach ($classReflection->getEnumCases() as $enumCase) {
if (array_key_exists($enumCase->getName(), $subtracedEnumCaseNames)) {
if (array_key_exists($enumCase->getName(), $subtractedEnumCaseNames)) {
continue;
}
$cases[] = new EnumCaseObjectType($className, $enumCase->getName(), $classReflection);
Expand Down Expand Up @@ -1373,9 +1373,11 @@ public function changeSubtractedType(?Type $subtractedType): Type
$classReflection = $this->getClassReflection();
$allowedSubTypesList = $classReflection !== null ? $classReflection->getAllowedSubTypes() : null;
if ($allowedSubTypesList !== null) {
$preciseVerbosity = VerbosityLevel::precise();

$allowedSubTypes = [];
foreach ($allowedSubTypesList as $allowedSubType) {
$allowedSubTypes[$allowedSubType->describe(VerbosityLevel::precise())] = $allowedSubType;
$allowedSubTypes[$allowedSubType->describe($preciseVerbosity)] = $allowedSubType;
}

$originalAllowedSubTypes = $allowedSubTypes;
Expand All @@ -1384,7 +1386,7 @@ public function changeSubtractedType(?Type $subtractedType): Type
$subtractedTypesList = TypeUtils::flattenTypes($subtractedType);
$subtractedTypes = [];
foreach ($subtractedTypesList as $type) {
$subtractedTypes[$type->describe(VerbosityLevel::precise())] = $type;
$subtractedTypes[$type->describe($preciseVerbosity)] = $type;
}

foreach ($subtractedTypes as $subType) {
Expand Down

0 comments on commit 9b8ddcb

Please sign in to comment.