From cf2107dd5cb03c38df9d3e16e96ec3e09ddfe2ec Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Sun, 12 Feb 2023 09:32:38 +0100 Subject: [PATCH] IterableType - fix getReferencedTemplateTypes again --- src/Type/IterableType.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Type/IterableType.php b/src/Type/IterableType.php index 9c0e26050a..ce7a01c916 100644 --- a/src/Type/IterableType.php +++ b/src/Type/IterableType.php @@ -358,9 +358,11 @@ public function inferTemplateTypes(Type $receivedType): TemplateTypeMap public function getReferencedTemplateTypes(TemplateTypeVariance $positionVariance): array { + $variance = $positionVariance->compose(TemplateTypeVariance::createCovariant()); + return array_merge( - $this->getIterableKeyType()->getReferencedTemplateTypes($positionVariance), - $this->getIterableValueType()->getReferencedTemplateTypes($positionVariance), + $this->getIterableKeyType()->getReferencedTemplateTypes($variance), + $this->getIterableValueType()->getReferencedTemplateTypes($variance), ); }