<?php // Generated by CuyZ\Valinor\Cache\FileSystemCache
return fn (array $transformers, CuyZ\Valinor\Normalizer\Transformer\Transformer $delegate) => new class ($transformers, $delegate) implements CuyZ\Valinor\Normalizer\Transformer\Transformer {
    private array $transformers;

    private CuyZ\Valinor\Normalizer\Transformer\Transformer $delegate;

    public function __construct(array $transformers, CuyZ\Valinor\Normalizer\Transformer\Transformer $delegate)
    {
        $this->transformers = $transformers;
        $this->delegate = $delegate;
    }

    public function transform(mixed $value): mixed
    {
        $references = new WeakMap();
        return $this->transform_object_cuyz_valinor_tests_integration_normalizer_classwithunresolvabletypeandstringnativetype_a54f43042f7e8b387fca94af92af8e09($value, $references);
    }

    private function transform_object_cuyz_valinor_tests_integration_normalizer_classwithunresolvabletypeandstringnativetype_a54f43042f7e8b387fca94af92af8e09(CuyZ\Valinor\Tests\Integration\Normalizer\ClassWithUnresolvableTypeAndStringNativeType $value, WeakMap $references): array
    {
        if (isset($references[$value])) {
            throw new CuyZ\Valinor\Normalizer\Exception\CircularReferenceFoundDuringNormalization($value);
        }
        $references = clone $references;
        $references[$value] = $value;
        $values = [
            'value' => $value->value,
        ];
        $transformed = [];
        $transformed['value'] = $this->transform_mixed($values['value'], $references);
        return $transformed;
    }

    private function transform_mixed(mixed $value, WeakMap $references): mixed
    {
        if (\is_bool($value)) {
            return $value;
        }
        if (\is_float($value)) {
            return $value;
        }
        if (\is_int($value)) {
            return $value;
        }
        if (\is_string($value)) {
            return $value;
        }
        if ($value === NULL) {
            return NULL;
        }
        if ($value instanceof UnitEnum) {
            return $value instanceof BackedEnum ? $value->value : $value->name;
        }
        if ($value instanceof DateTime) {
            return $value->format('Y-m-d\\TH:i:s.uP');
        }
        if ($value instanceof DateTimeZone) {
            return $value->getName();
        }
        if (\is_iterable($value) && ! $value instanceof Generator) {
            return $this->transform_iterable_mixed_070660c7e72aa3e14a93c1039279afb6($value, $references);
        }
        return $this->delegate->transform($value);
    }

    private function transform_iterable_mixed_070660c7e72aa3e14a93c1039279afb6(iterable $value, WeakMap $references): iterable
    {
        if (\is_array($value)) {
            return \array_map(fn (mixed $item) => $this->transform_mixed($item, $references), $value);
        }
        return (function () use ($value, $references) {
            foreach ($value as $key => $item) {
                yield $key => $this->transform_mixed($item, $references);
            }
        })();
    }
};
