resolver = $resolver; } public function getClass(): string { return TreeMapper::class; } public function isMethodSupported(MethodReflection $methodReflection): bool { return $methodReflection->getName() === 'map'; } public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type { $argument = $methodCall->getArgs()[0]->value; $type = $scope->getType($argument); if ($type instanceof UnionType) { return $type->traverse(fn (Type $type) => $this->type($type)); } return $this->type($type); } private function type(Type $type): Type { if ($type instanceof GenericClassStringType) { return $type->getGenericType(); } if ($type instanceof ConstantStringType) { return $this->resolver->resolve($type->getValue()); } return new MixedType(); } }