diff --git a/src/Type/Enum/EnumCaseObjectType.php b/src/Type/Enum/EnumCaseObjectType.php index ee2617d0dd..78987c477e 100644 --- a/src/Type/Enum/EnumCaseObjectType.php +++ b/src/Type/Enum/EnumCaseObjectType.php @@ -79,7 +79,7 @@ public function isSuperTypeOf(Type $type): TrinaryLogic return $type->isSubTypeOf($this); } - $parent = new parent($this->getClassName(), $this->getSubtractedType()); + $parent = new parent($this->getClassName(), $this->getSubtractedType(), $this->getClassReflectionOrNull()); return $parent->isSuperTypeOf($type)->and(TrinaryLogic::createMaybe()); } @@ -165,7 +165,7 @@ public function getBackingValueType(): ?Type public function generalize(GeneralizePrecision $precision): Type { - return new parent($this->getClassName()); + return new parent($this->getClassName(), null, $this->getClassReflectionOrNull()); } public function isSmallerThan(Type $otherType): TrinaryLogic diff --git a/src/Type/ObjectType.php b/src/Type/ObjectType.php index c9e89e5841..a5d1c326cc 100644 --- a/src/Type/ObjectType.php +++ b/src/Type/ObjectType.php @@ -1479,6 +1479,11 @@ public function getClassReflection(): ?ClassReflection return $classReflection; } + protected function getClassReflectionOrNull(): ?ClassReflection + { + return $this->classReflection; + } + /** * @return self|null */