diff --git a/src/Type/UnionType.php b/src/Type/UnionType.php index b58890a9fb..f1b7f93223 100644 --- a/src/Type/UnionType.php +++ b/src/Type/UnionType.php @@ -85,6 +85,8 @@ class UnionType implements CompoundType private ?TrinaryLogic $isNull = null; + private ?TrinaryLogic $isCallable = null; + /** * @api * @param list $types @@ -1126,7 +1128,7 @@ public function getEnumCaseObject(): ?EnumCaseObjectType public function isCallable(): TrinaryLogic { - return $this->unionResults(static fn (Type $type): TrinaryLogic => $type->isCallable()); + return $this->isCallable ??= $this->unionResults(static fn (Type $type): TrinaryLogic => $type->isCallable()); } public function getCallableParametersAcceptors(ClassMemberAccessAnswerer $scope): array