<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\ArgumentResolver;

use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Stopwatch\Stopwatch;

/**
 * @author Robin Chalas <robin.chalas@gmail.com>
 */
class TraceableArgumentResolver implements ArgumentResolverInterfa

onFunctionAbstract $reflector = null): array
    {
        $e = $this->stopwatch->start('command.get_arguments');

        try {
            return $this->resolver->getArguments($input, $command, $reflector);
        } finally {
            $e->stop();

ce
{
    public function __construct(
        private ArgumentResolverInterface $resolver,
        private Stopwatch $stopwatch,
    ) {
    }

    public function getArguments(InputInterface $input, callable $command, ?\Reflecti


ge.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\ArgumentResolver\ValueResolver;

use Symfony\Component\Console\Attribute\Argument;
use Symfony\Component\Console\Attribute\Option;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Input\InputInterface;

/**
 * Resolves values from #[Argume

   public function resolve(string $argumentName, InputInterface $input, ReflectionMember $member): iterable
    {
        if ($member->isVariadic()) {
            return [];
        }

        if ($argument = Argument::tryFrom($member->getMember())) {

nt] or #[Option] attributes for built-in PHP types.
 *
 * Handles: string, bool, int, float, array
 *
 * @author Robin Chalas <robin.chalas@gmail.com>
 */
final class BuiltinTypeValueResolver implements ValueResolverInterface
{


 part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\ArgumentResolver\ValueResolver;

use Symfony\Component\Console\Attribute\Argument;
use Symfony\Component\Console\Attribute\Option;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Input\File\InputFile;
use Symfony

rface $input, ReflectionMember $member): iterable
    {
        $type = $member->getType();

        if (!$type instanceof \ReflectionNamedType || InputFile::class !== $type->getName()) {
            return [];
        }

        if ($argument = Argument::

\Component\Console\Input\InputInterface;

/**
 * @author Robin Chalas <robin.chalas@gmail.com>
 */
final class InputFileValueResolver implements ValueResolverInterface
{
    public function resolve(string $argumentName, InputInte


buted with this source code.
 */

namespace Symfony\Component\Console\ArgumentResolver;

use Psr\Container\ContainerInterface;
use Symfony\Component\Console\ArgumentResolver\Exception\NearMissValueResolverException;
use Symfony\Component\Console\ArgumentResolver\Exception\ResolverNotFoundException;
use Symfony\Component\Console\ArgumentResolver\ValueResolver as Resolver;
use Symfony\Component\Console\ArgumentResolver\ValueResolver\ValueResolverInterface;
use Symfony\Component\Console\Attribute\Argument;
use

omponent\Console\Cursor;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\RawInputInterface;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\Console\Style\SymfonyStyle;
use Symfony\Contract

 Symfony\Component\Console\Attribute\Option;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Attribute\ValueResolver;
use Symfony\Component\Console\Command\Command;
use Symfony\C


hp

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Mapping\Write;

use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoaderInterface;

trigger_deprecation('symfony/json-streamer', '8.1', 'The "%s" class is deprecated, Date times are handled as value objects.', DateTimeTypePrope

implements PropertyMetadataLoaderInterface
{
    public function __construct(
        private PropertyMetadataLoaderInterface $decorated,
    ) {
    }

    public function load(string $className, array $options = [], array $context = []): array
    {

rtyMetadataLoader::class);

/**
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @deprecated since Symfony 8.1, Date times are handled as value objects
 *
 * @internal
 */
final class DateTimeTypePropertyMetadataLoader


er\Exception\NotEncodableValueException;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Exception\UnexpectedValueException;
use Symfony\Component\JsonStreamer\PhpGeneratorTrait;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\Type\NullableType;
use Symfony\Component\TypeInfo\Type\ObjectType;
use Symfony\Component\TypeInfo\Type\WrappingTypeInterface;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
 * Generates PHP code tha

ct(
        private ContainerInterface $transformers,
    ) {
    }

    /**
     * @param array<string, mixed> $options
     * @param array<string, mixed> $context
     */
    public function generate(DataModelNodeInterface $dataModel, array $options = []

t writes data to JSON stream.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @internal
 */
final class PhpGenerator
{
    use PhpGeneratorTrait;

    private string $yieldBuffer = '';

    public function __constru


buted with this source code.
 */

namespace Symfony\Component\JsonStreamer\Write;

use Psr\Container\ContainerInterface;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\JsonStreamer\DataModel\Write\BackedEnumNode;
use Symfony\Component\JsonStreamer\DataModel\Write\CollectionNode;
use Symfony\Component\JsonStreamer\DataModel\Write\CompositeNode;
use Symfony\Component\JsonStreamer\DataModel\Write\DataModelNodeInterface;
use Symfony\Component\JsonStreamer\DataModel\Write\ObjectN

mer\Mapping\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\StreamerDumper;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\BackedEnumType;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\

ode;
use Symfony\Component\JsonStreamer\DataModel\Write\ScalarNode;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Exception\UnsupportedException;
use Symfony\Component\JsonStrea


 part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\ValueTransformer;

use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Transformer\DateTimeValueObjectTransformer;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use

eTimeValueObjectTransformer::class);

/**
 * Transforms DateTimeInterface to string during stream writing.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @deprecated since Symfony 8.1, date times will be transformed thanks to DateTimeValueOb

 Symfony\Component\TypeInfo\TypeIdentifier;

trigger_deprecation('symfony/json-streamer', '8.1', 'The "%s" class is deprecated. Date times will be transformed thanks to "%s" instead.', DateTimeToStringValueTransformer::class, Dat


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\ValueTransformer;

use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Transformer\DateTimeValueObjectTransformer;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\TypeIdentifier;

trigger_deprecation('symfony/jso

utable during stream reading.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @deprecated since Symfony 8.1, date times will be transformed thanks to DateTimeValueObjectTransformer instead
 */
final class StringToDateTimeValueTransformer impl

n-streamer', '8.1', 'The "%s" class is deprecated. Date times will be transformed thanks to "%s" instead.', StringToDateTimeValueTransformer::class, DateTimeValueObjectTransformer::class);

/**
 * Transforms string to DateTimeImm


ony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\ValueTransformer;

use Symfony\Component\JsonStreamer\Transformer\PropertyValueTransformerInterface;

trigger_deprecation('symfony/json-streamer', '8.1', 'The "%s" interface is deprecated, use "%s" instead.', ValueTransformerInterface::class, PropertyValueTransformerInterface::class);

/**
 * Transforms a native value before

or Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @deprecated since Symfony 8.1, use Symfony\Component\JsonStreamer\Transformer\PropertyValueTransformerInterface instead
 */
interface ValueTransformerInterface extends PropertyValueTransformerInterface
{
}

stream writing and after stream reading.
 *
 * @auth


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\CacheWarmer;

use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Psr\Log\NullLogger;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\HttpKernel\CacheWarmer\CacheWarmerInterface;
use Symfony\Component\JsonStreamer\Exception\ExceptionInterface;
use Symfony\Component\JsonStreamer\Mappi

ers and stream writers PHP files.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @internal
 */
final class StreamerCacheWarmer implements CacheWarmerInterface
{
    private StreamWriterGenerator $streamWriterGenerator;
    private StreamRead

ng\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\Read\StreamReaderGenerator;
use Symfony\Component\JsonStreamer\Write\StreamWriterGenerator;
use Symfony\Component\TypeInfo\Type;

/**
 * Generates stream read


onStreamReader;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Mapping\SyntheticPropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateIntervals;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateTimes;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateTimeZones;
use Symfony\Component\JsonS

treamer\Tests\Fixtures\Model\DummyWithGenerics;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNullableProperties;
use Symfony\Com


Fixtures\Model\DummyWithArray;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateIntervals;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateTimes;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateTimeZones;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDollarNamedProperties;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithGenerics;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithList;
use Symfony

s;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedList;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedListDummies;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNullableProperties;
use Sym


buted with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\Config\ConfigCacheFactory;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\StreamerDumper;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum;
use Symfony\Component\JsonStreamer\

Fixtures\Model\DummyWithOtherDummies;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithRepeatedOtherDummy;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\SelfReferencingDummy;
use Symfony\Component\TypeInfo\Type;
use Symfony\Compon

Tests\Fixtures\Model\ClassicDummy;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithArray;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes;
use Symfony\Component\JsonStreamer\Tests\


 part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Read;

use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\UnexpectedValueException;
use Symfony\Component\JsonStreamer\Read\Decoder;

class DecoderTest extends TestCase
{
    public function testDecode()
    {
        $this->a

is->expectException(UnexpectedValueException::class);
        $this->expectExceptionMessage('JSON is not valid: Syntax error');

        Decoder::decodeString('foo"');
    }

    public function testDecodeThrowOnInvalidJsonStream()
    {
        $this->exp

ssertDecoded('foo', '"foo"');
    }

    public function testDecodeSubset()
    {
        $this->assertDecoded('bar', '["foo","bar","baz"]', 7, 5);
    }

    public function testDecodeThrowOnInvalidJsonString()
    {
        $th


 This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Read;

use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\UnexpectedValueException;
use Symfony\Component\JsonStreamer\Read\Instantiator;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy;

clas

> 100,
            'name' => 'dummy',
        ];

        $this->assertEquals($expected, (new Instantiator())->instantiate(ClassicDummy::class, $properties));
    }

    public function testThrowOnInvalidProperty()
    {
        $this->expectException(Unex

s InstantiatorTest extends TestCase
{
    public function testInstantiate()
    {
        $expected = new ClassicDummy();
        $expected->id = 100;
        $expected->name = 'dummy';

        $properties = [
            'id' =


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Read;

use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Read\LazyInstantiator;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy;

class LazyInstantiatorTest extends TestCase
{
    public function testCreateLazyGhostUsingPhp()

lic function testInstantiateInternalClassEagerly()
    {
        $object = (new LazyInstantiator())->instantiate(\DateTimeImmutable::class, static function (\DateTimeImmutable $object): void {
        });

        $this->assertInstanceOf(\DateTimeImmutable

  {
        $ghost = (new LazyInstantiator())->instantiate(ClassicDummy::class, static function (ClassicDummy $object): void {
            $object->id = 123;
        });

        $this->assertSame(123, $ghost->id);
    }

    pub


buted with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Read;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\InvalidStreamException;
use Symfony\Component\JsonStreamer\Read\Lexer;

class LexerTest extends TestCase
{
    private const RFC8259_TEST_SUITE_PATH = '/vendor/nst/json-test-suite';

    public function testTokens()
    {
        $this->assertTokens([['1', 0]], '1');
        $this->assertTokens([['f

alse', 0]], 'false');
        $this->assertTokens([['null', 0]], 'null');
        $this->assertTokens([['"string"', 0]], '"string"');
        $this->assertTokens([['[', 0], [']', 1]], '[]');
        $this->assertTokens([['[', 0],


buted with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Read;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\InvalidStreamException;
use Symfony\Component\JsonStreamer\Read\Splitter;

class SplitterTest extends TestCase
{
    public function testSplitNull()
    {
        $this->assertListBoundaries(null, 'null');
        $this->assertDictBoundaries(null, 'null');
    }

    public function testSplitList()

, '[1,[2,3]]');
        $this->assertListBoundaries([[1, 1], [3, 7]], '[1,{"2":3}]');
    }

    public function testSplitDict()
    {
        $this->assertDictBoundaries([], '{}');
        $this->assertDictBoundaries(['k' => [5, 2]], '{"k":10}');

    {
        $this->assertListBoundaries([], '[]');
        $this->assertListBoundaries([[1, 3]], '[100]');
        $this->assertListBoundaries([[1, 3], [5, 3]], '[100,200]');
        $this->assertListBoundaries([[1, 1], [3, 5]]


eption\LogicException;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Exception\UnsupportedException;
use Symfony\Component\JsonStreamer\Mapping\GenericTypePropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadata;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\Mapping\Read\AttributePropertyMetadataLoad

er;
use Symfony\Component\JsonStreamer\Read\StreamReaderGenerator;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyEnum;
use Symfony\Component\Js


<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Attribute;

use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Attribute\ValueTransformer;
use Symfony\Component\JsonStreamer\Exception\LogicException;

class ValueTransformerTest extends TestCase
{
    public f

nnotCreateWithoutAnything()
    {
        $this->expectException(LogicException::class);
        $this->expectExceptionMessage('#[ValueTransformer] attribute must declare either $streamToNative or $nativeToStream.');

        new ValueTransformer();
    }


buted with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Transformer;

use PHPUnit\Framework\Attributes\DataProvider;
use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Transformer\DateIntervalValueObjectTransformer;

class DateIntervalValueObjectTransformerTest extends TestCase
{
    public function testTransform()
    {
        $transformer = new DateIntervalValueObjectTransformer();

        $th

rval('P2Y6M1DT12H30M5S')),
        );

        $this->assertSame(
            '2 years',
            $transformer->transform(new \DateInterval('P2Y'), [DateIntervalValueObjectTransformer::FORMAT_KEY => '%y years']),
        );
    }

    public function te

is->assertSame(
            'P0Y0M0DT0H0M0S',
            $transformer->transform(new \DateInterval('P0Y')),
        );

        $this->assertSame(
            'P2Y6M1DT12H30M5S',
            $transformer->transform(new \DateInte


buted with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Transformer;

use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Transformer\DateTimeValueObjectTransformer;

class DateTimeValueObjectTransformerTest extends TestCase
{
    public function testTransform()
    {
        $transformer = new DateTimeValueObjectTransformer();

        $this->assertSame(
            '2023-07-26T00:00:00+00:00',

mutable('2023-07-26', new \DateTimeZone('UTC')))->setTime(0, 0), [DateTimeValueObjectTransformer::FORMAT_KEY => 'd/m/Y H:i:s']),
        );
    }

    public function testTransformWithTimezone()
    {
        $transformer = new DateTimeValueObjectTransform

          $transformer->transform(new \DateTimeImmutable('2023-07-26', new \DateTimeZone('UTC')), []),
        );

        $this->assertSame(
            '26/07/2023 00:00:00',
            $transformer->transform((new \DateTimeIm


ge.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Transformer;

use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Transformer\DateTimeZoneValueObjectTransformer;

class DateTimeZoneValueObjectTransformerTest extends TestCase
{
    public fu

mer->transform(new \DateTimeZone('Asia/Tokyo')));
        $this->assertSame('Europe/Paris', $transformer->transform(new \DateTimeZone('Europe/Paris')));
    }

    public function testTransformThrowWhenInvalidNativeValue()
    {
        $this->expectExcept

nction testTransform()
    {
        $transformer = new DateTimeZoneValueObjectTransformer();

        $this->assertSame('UTC', $transformer->transform(new \DateTimeZone('UTC')));
        $this->assertSame('Asia/Tokyo', $transfor


/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Transformer;

use Symfony\Component\JsonStreamer\Tests\Fixtures\ValueObject\Height;
use Symfony\Component\JsonStreamer\Transformer\ValueObjectTransformerInterface;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\T

 $options = []): int|float|string|bool|null
    {
        return $object->value.' '.$object->unit;
    }

    public function reverseTransform(int|float|string|bool|null $scalar, array $options = []): object
    {
        return new Height(...explode(' ',

ypeInfo\Type\BuiltinType;

/**
 * @implements ValueObjectTransformerInterface<Height, string>
 */
class HeightValueObjectTransformer implements ValueObjectTransformerInterface
{
    public function transform(object $object, array


 This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Transformer;

use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithValueObjectAndUnion;
use Symfony\Component\JsonStreamer\Transformer\ValueObjectTransformerInterface;
use Symfony\Component\TypeInfo\Type;
use Symfony\C

er implements ValueObjectTransformerInterface
{
    public function transform(object $object, array $options = []): int|float|string|bool|null
    {
        throw new \BadMethodCallException('Not implemented.');
    }

    public function reverseTransform(

omponent\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
 * @implements ValueObjectTransformerInterface<DummyWithValueObjectAndUnion, mixed>
 */
final class UnsupportedStreamValueTypeObjectTransform


ic function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['array{\'id\': int, \'name\': string}'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::splitDict($stream, $offset, $length);
        $iterable = static function ($stream, $data) use ($options, $transforme

h ($data as $k => $v) {
                yield $k => \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]);
            }
        };
        return \iterator_to_array($iterable($stream, $data));
    };
    return $providers['arra

rs, $instantiator, &$providers) {
            foreac


 mixed>
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['array<string, mixed>'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::splitDict($stream, $offset, $length);
        $iterable = static function ($stream, $data) use ($options, $tra

 foreach ($data as $k => $v) {
                yield $k => \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]);
            }
        };
        return \iterator_to_array($iterable($stream, $data));
    };
    return $provider


terable
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['iterable'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::splitDict($stream, $offset, $length);
        $iterable = static function ($stream, $data) use ($options, $transformers, $

ata as $k => $v) {
                yield $k => \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]);
            }
        };
        return $iterable($stream, $data);
    };
    return $providers['iterable']($stream, 0, null);

instantiator, &$providers) {
            foreach ($d


atic function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['list<mixed>'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::splitList($stream, $offset, $length);
        $iterable = static function ($stream, $data) use ($options, $transformers, $instantiator, &$pr

                yield $k => \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]);
            }
        };
        return \iterator_to_array($iterable($stream, $data));
    };
    return $providers['list<mixed>']($stream, 0, n

oviders) {
            foreach ($data as $k => $v) {


* @return Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum|null
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum'] = static function ($data) {
        return \Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum::from($data);
    };
    $provide

['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum']($data);
        }
        if (null === $data) {
            return null;
        }
        throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('U

rs['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum|null'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        if (\is_int($data)) {
            return $providers


fony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum|null
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum'] = static function ($stream, $offset, $length) {
        return \Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum::from(\Symfony\Component\JsonStream

formers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $offset, $length);
        if (\is_int($data)) {
            return $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\En

er\Read\Decoder::decodeStream($stream, $offset, $length));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum|null'] = static function ($stream, $offset, $length) use ($options, $trans


fony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy|null
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        return $instantiator->instantiate(\Symfony\Component\JsonStreamer\T

 $v;
        }));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy|null'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        if (\is_array($data)) {
            return

ests\Fixtures\Model\ClassicDummy::class, \array_filter(['id' => $data['id'] ?? '_symfony_missing_value', 'name' => $data['name'] ?? '_symfony_missing_value'], static function ($v) {
            return '_symfony_missing_value' !==


ge.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\Terminal\Image;

/**
 * Handles the iTerm2 Inline Images Protocol (OSC 1337).
 *
 * The iTerm2 protocol uses Operating System Command (OSC) sequences:
 * - Start: ESC ] 1337 ; File= (0x1B 0x5D 0x31 0x33 0x33 0x37 0x3B 0x46 0x69 0x6C 0x65 0x3D)
 * - End: BEL (0x07) or ESC \ (0x1B 0x5C)
 *

ocolInterface
{
    public const OSC_START = "\x1b]1337;File=";
    public const BEL = "\x07";
    public const ST = "\x1b\\";

    public function detectPastedImage(string $data): bool
    {
        return str_contains($data, self::OSC_START);
    }

 * Format: ESC]1337;File=[arguments]:[base64 data]BEL
 *
 * @see https://iterm2.com/documentation-images.html
 *
 * @author Robin Chalas <robin.chalas@gmail.com>
 *
 * @internal
 */
final class ITerm2Protocol implements ImageProt


r\Tests\Fixtures\Model\ClassicDummy|null
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::splitDict($stream, $offset,

            foreach ($data as $k => $v) {
                match ($k) {
                    'id' => $object->id = \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]),
                    'name' => $object->name = \Symfony\Compo

 $length);
        return $instantiator->instantiate(\Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy::class, static function ($object) use ($stream, $data, $options, $transformers, $instantiator, &$providers) {


nt\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['array<string, Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy>'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        $iterable = static function ($data) use ($options, $transformer

urn \iterator_to_array($iterable($data));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        return $instantiator->in

s, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                yield $k => $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy']($v);
            }
        };
        ret


nt\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>|null
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['array<string, Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy>'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitte

iders['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy']($stream, $v[0], $v[1]);
            }
        };
        return \iterator_to_array($iterable($stream, $data));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\F

r::splitDict($stream, $offset, $length);
        $iterable = static function ($stream, $data) use ($options, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                yield $k => $prov


reamer\Tests\Fixtures\Model\ClassicDummy>|null
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['list<Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy>'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        $iterable = static function ($data) use ($options, $transformers, $instantiator,

rray($iterable($data));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        return $instantiator->instantiate(\Symfony

&$providers) {
            foreach ($data as $k => $v) {
                yield $k => $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy']($v);
            }
        };
        return \iterator_to_a


buted with this source code.
 */

namespace Symfony\Component\Console\ArgumentResolver\ValueResolver;

use Symfony\Component\Console\Attribute\Argument;
use Symfony\Component\Console\Attribute\MapInput;
use Symfony\Component\Console\Attribute\Option;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Exception\InputValidationFailedException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Validator\Validator\ValidatorInterface;

/**

implements ValueResolverInterface
{
    public function __construct(
        private readonly ValueResolverInterface $builtinTypeResolver,
        private readonly ValueResolverInterface $backedEnumResolver,
        private readonly ValueResolverInterface

* Resolves the value of a input argument/option to an object holding the #[MapInput] attribute.
 *
 * @author Yonel Ceruto <open@yceruto.dev>
 * @author Robin Chalas <robin.chalas@gmail.com>
 */
final class MapInputValueResolver


buted with this source code.
 */

namespace Symfony\Component\Console\Input;

use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Completion\CompletionInput;
use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Completion\Suggestion;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\LogicException;

/**
 * Represents a command line option.
 *
 * @author Fabien Potencier <fabien@symfony.c

 is used (e.g. --iterations=5 or -i5).
     */
    public const VALUE_REQUIRED = 2;

    /**
     * The option may or may not have a value (e.g. --yell or --yell=loud).
     */
    public const VALUE_OPTIONAL = 4;

    /**
     * The option accepts multipl

om>
 */
class InputOption
{
    /**
     * Do not accept input for the option (e.g. --yell). This is the default behavior of options.
     */
    public const VALUE_NONE = 1;

    /**
     * A value must be passed when the option


ackage.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\Input;

/**
 * StreamableInputInterface is the interface implemented by all input classes
 * that have an input stream.
 *
 * @author Robin Chalas <robin.chalas@gmail.com>
 */
interface StreamableInputInterface extends InputInterface
{
    /**
     * Sets the input stream to read from

is mainly useful for testing purpose.
     *
     * @param resource $stream The input stream
     */
    public function setStream($stream): void;

    /**
     * Returns the input stream.
     *
     * @return resource|null
     */
    public function get

 when interacting with the user.
     *
     * This


 part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\Debug;

use Symfony\Component\Console\Command\TraceableCommand;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;

/**
 * @internal
 */
final class CliRequest extends Request
{
    public function __construct(
        pu

// Methods below allow to populate a profile, thus enable search and filtering
    public function getUri(): string
    {
        if ($this->server->has('SYMFONY_CLI_BINARY_NAME')) {
            $binary = $this->server->get('SYMFONY_CLI_BINARY_NAME').' con

blic readonly TraceableCommand $command,
    ) {
        parent::__construct(
            attributes: ['_controller' => $command->command::class, '_virtual_type' => 'command'],
            server: $_SERVER,
        );
    }


n Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\Completion\Output;

use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * @author Wouter de Jong <wouter@wouterj.nl>
 */
class BashCompletionOutput implements CompletionOutputInterface
{
    public function write(CompletionSuggestions $

      $values = $suggestions->getValueSuggestions();
        foreach ($suggestions->getOptionSuggestions() as $option) {
            $values[] = '--'.$option->getName();
            if ($option->isNegatable()) {
                $values[] = '--no-'.$option-

suggestions, OutputInterface $output): void
    {


ception;

/**
 * Retrieves lexical tokens from a given stream.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @internal
 */
final class Lexer
{
    private const MAX_CHUNK_LENGTH = 8192;
    private const MAX_DEPTH = 512;

    private const WHITESPACE_CHARS = [' ' => true, "\r" => true, "\t" => true, "\n" => true];
    private const STRUCTURE_CHARS = [',' => true, ':' => true, '{' => true, '}' => true, '[' => true, ']' => true];

    private const TOKEN_DICT_START = 1;
    private const TOKEN

R = 128;
    private const TOKEN_END = 256;
    private const TOKEN_VALUE = self::TOKEN_DICT_START | self::TOKEN_LIST_START | self::TOKEN_SCALAR;

    private const KEY_REGEX = '/^(?:(?>"(?>\\\\(?>["\\\\\/bfnrt]|u[a-fA-F0-9]{4})|[^\0-\x1F\\\\"]+)*"))$/u';

_DICT_END = 2;
    private const TOKEN_LIST_START = 4;
    private const TOKEN_LIST_END = 8;
    private const TOKEN_KEY = 16;
    private const TOKEN_COLUMN = 32;
    private const TOKEN_COMMA = 64;
    private const TOKEN_SCALA


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Read;

use Symfony\Component\JsonStreamer\Exception\UnexpectedValueException;

/**
 * Splits collections to retrieve the offset and length of each element.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 */
final class Splitter
{
    private const NESTING_CHARS = ['{' => true, '[' => true];
    private const UNNESTING_CHARS

e $stream
     */
    public static function splitList($stream, int $offset = 0, ?int $length = null): ?\Iterator
    {
        $lexer = self::$lexer ??= new Lexer();
        $tokens = $lexer->getTokens($stream, $offset, $length);

        if ('null' === $

= ['}' => true, ']' => true];

    private static ?Lexer $lexer = null;

    /**
     * @var array{key: array<string, string>}
     */
    private static array $cache = [
        'key' => [],
    ];

    /**
     * @param resourc


 part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Attribute;

use Symfony\Component\JsonStreamer\Exception\LogicException;
use Symfony\Component\JsonStreamer\Transformer\PropertyValueTransformerInterface;

/**
 * Defines a callable or a {@see PropertyValueTransformerInterface} service id
 * that will be use

eamToNative;
    private \Closure|string|null $nativeToStream;

    /**
     * @param (callable(mixed, array<string, mixed>=): mixed)|string|null $streamToNative
     * @param (callable(mixed, array<string, mixed>=): mixed)|string|null $nativeToStream

d to transform the property data during stream reading/writing.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 */
#[\Attribute(\Attribute::TARGET_PROPERTY)]
class ValueTransformer
{
    private \Closure|string|null $str


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Transformer;

use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
 * Transforms a {@see \DateInterval} to a string and vice versa.
 *
 * @author Mathias Arlaud <mathias.arlaud@gm

nsformer implements ValueObjectTransformerInterface
{
    public const FORMAT_KEY = 'date_interval_format';

    private const DEFAULT_FORMAT = '%rP%yY%mM%dDT%hH%iM%sS';

    /**
     * @param Options $options
     */
    public function transform(object $

ail.com>
 *
 * @psalm-type Options = array{
 *     date_interval_format?: string,
 *     ...<string, mixed>,
 * }
 *
 * @implements ValueObjectTransformerInterface<\DateInterval, string>
 */
final class DateIntervalValueObjectTra


*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Transformer;

use Symfony\Component\TypeInfo\Type;

/**
 * Transforms a property value before stream writing and after stream reading.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 */
interface PropertyValueTransformerInterface
{

ect?: object, // When writing stream: the object holding the current property
     *     ...<string, mixed>,
     * } $options
     */
    public function transform(mixed $value, array $options = []): mixed;

    public static function getStreamValueType()

    /**
     * @param array{
     *     _current_obj


 This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Transformer;

use Symfony\Component\TypeInfo\Type\BuiltinType;

/**
 * Transforms value objects during stream writing and reading.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @template T of object
 * @template U of int|float|st

  * @return U
     */
    public function transform(object $object, array $options = []): int|float|string|bool|null;

    /**
     * Reverses the transformation from a scalar value back into a value object.
     *
     * @param U                    $scala

ring|bool|null
 */
interface ValueObjectTransformerInterface
{
    /**
     * Transforms a value object into a scalar value.
     *
     * @param T                    $object
     * @param array<string, mixed> $options
     *


 part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Mapping;

use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\TypeInfo\TypeResolver\TypeResolverInterface;

/**
 * Loads basic properties stream reading/writing metadata for a given $className.
 *
 * @author Mathias Arlaud <m

 public function load(string $className, array $options = [], array $context = []): array
    {
        $result = [];

        try {
            $classReflection = new \ReflectionClass($className);
        } catch (\ReflectionException $e) {
            th

athias.arlaud@gmail.com>
 *
 * @internal
 */
final class PropertyMetadataLoader implements PropertyMetadataLoaderInterface
{
    public function __construct(
        private TypeResolverInterface $typeResolver,
    ) {
    }


buted with this source code.
 */

namespace Symfony\Component\JsonStreamer\Mapping\Read;

use Psr\Container\ContainerInterface;
use Symfony\Component\JsonStreamer\Attribute\StreamedName;
use Symfony\Component\JsonStreamer\Attribute\ValueTransformer;
use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\Transformer\Prope

based on properties' attributes.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @internal
 */
final class AttributePropertyMetadataLoader implements PropertyMetadataLoaderInterface
{
    public function __construct(
        private PropertyM

rtyValueTransformerInterface;
use Symfony\Component\JsonStreamer\Transformer\ValueObjectTransformerInterface;
use Symfony\Component\TypeInfo\TypeResolver\TypeResolverInterface;

/**
 * Enhances properties stream reading metadata


buted with this source code.
 */

namespace Symfony\Component\JsonStreamer\Mapping\Write;

use Psr\Container\ContainerInterface;
use Symfony\Component\JsonStreamer\Attribute\StreamedName;
use Symfony\Component\JsonStreamer\Attribute\ValueTransformer;
use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\Transformer\Prop

 based on properties' attributes.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @internal
 */
final class AttributePropertyMetadataLoader implements PropertyMetadataLoaderInterface
{
    public function __construct(
        private Property

ertyValueTransformerInterface;
use Symfony\Component\JsonStreamer\Transformer\ValueObjectTransformerInterface;
use Symfony\Component\TypeInfo\TypeResolver\TypeResolverInterface;

/**
 * Enhances properties stream writing metadata


 part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\Messenger;

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\RunCommandFailedException;
use Symfony\Component\Console\Input\StringInput;
use Symfony\Component\Console\Output\Buffered

ndMessageHandler
{
    public function __construct(
        private readonly Application $application,
    ) {
    }

    public function __invoke(RunCommandMessage $message): RunCommandContext
    {
        $input = new StringInput($message->input);

Output;
use Symfony\Component\Messenger\Exception\RecoverableExceptionInterface;
use Symfony\Component\Messenger\Exception\UnrecoverableExceptionInterface;

/**
 * @author Kevin Bond <kevinbond@gmail.com>
 */
final class RunComma


ge.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\ArgumentResolver\ValueResolver;

use Symfony\Component\Console\Attribute\Argument;
use Symfony\Component\Console\Attribute\Option;
use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\C

 Jérôme Tamarelle <jerome@tamarelle.net>
 * @author Maxime Steinhausser <maxime.steinhausser@gmail.com>
 */
final class BackedEnumValueResolver implements ValueResolverInterface
{
    public function resolve(string $argumentName, InputInterface $input, Ref

onsole\Exception\InvalidOptionException;
use Symfony\Component\Console\Input\InputInterface;

/**
 * Resolves a BackedEnum instance from a Command argument or option.
 *
 * @author Robin Chalas <robin.chalas@gmail.com>
 * @author


halas <robin.chalas@gmail.com>
 */
final class UidValueResolver implements ValueResolverInterface
{
    public function resolve(string $argumentName, InputInterface $input, ReflectionMember $member): iterable
    {
        if ($argument = Argument::tryFrom

onsole\Exception\InvalidOptionException;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Uid\AbstractUid;

/**
 * Resolves an AbstractUid instance from a Command argument or option.
 *
 * @author Robin C


buted with this source code.
 */

namespace Symfony\Component\Console\Completion;

use Symfony\Component\Console\Exception\RuntimeException;
use Symfony\Component\Console\Input\ArgvInput;
use Symfony\Component\Console\Input\InputDefinition;
use Symfony\Component\Console\Input\InputOption;

/**
 * An input specialized for shell completion.
 *
 * This input allows unfinished option names or values and exposes what kind of
 * completion is expected.
 *
 * @author Wouter de Jong <wouter@wouterj.nl>
 */
final cl

 'none';

    private array $tokens;
    private int $currentIndex;
    private string $completionType;
    private ?string $completionName = null;
    private string $completionValue = '';

    /**
     * Converts a terminal string into tokens.
     *

ass CompletionInput extends ArgvInput
{
    public const TYPE_ARGUMENT_VALUE = 'argument_value';
    public const TYPE_OPTION_VALUE = 'option_value';
    public const TYPE_OPTION_NAME = 'option_name';
    public const TYPE_NONE =


nt\JsonStreamer\DataModel\Read\CollectionNode;
use Symfony\Component\JsonStreamer\DataModel\Read\CompositeNode;
use Symfony\Component\JsonStreamer\DataModel\Read\DataModelNodeInterface;
use Symfony\Component\JsonStreamer\DataModel\Read\ObjectNode;
use Symfony\Component\JsonStreamer\DataModel\Read\ScalarNode;
use Symfony\Component\JsonStreamer\Exception\LogicException;
use Symfony\Component\JsonStreamer\Exception\UnexpectedValueException;
use Symfony\Component\JsonStreamer\PhpGeneratorTrait;
use Symfony\Comp

TypeInterface;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
 * Generates PHP code that reads JSON stream.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @internal
 */
final class PhpGenerator
{
    use PhpGeneratorTrait;

    public f

onent\TypeInfo\Type\BackedEnumType;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\Type\CollectionType;
use Symfony\Component\TypeInfo\Type\ObjectType;
use Symfony\Component\TypeInfo\Type\Wrapping


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Transformer;

use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
 * Transforms a {@see \DateTimeInterface} to a string and vice versa.
 *
 * @author Mathias Arlaud <mathias.arla

face, string>
 */
final class DateTimeValueObjectTransformer implements ValueObjectTransformerInterface
{
    public const FORMAT_KEY = 'date_time_format';
    public const TIMEZONE_KEY = 'date_time_timezone';

    /**
     * @param Options $options
     *

ud@gmail.com>
 *
 * @psalm-type Options = array{
 *     date_time_format?: string,
 *     date_time_timezone?: string|\DateTimeZone,
 *     ...<string, mixed>,
 * }
 *
 * @implements ValueObjectTransformerInterface<\DateTimeInter


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Mapping;

use Symfony\Component\TypeInfo\Exception\InvalidArgumentException;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\CollectionType;
use Symfony\Component\TypeInfo\Type\GenericType;
use Symfony\Component\TypeInfo\Type\IntersectionType;
use Symfony\Component\TypeInfo\Type\ObjectType;
use Symfony\Compon

@author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @internal
 */
final class GenericTypePropertyMetadataLoader implements PropertyMetadataLoaderInterface
{
    public function __construct(
        private PropertyMetadataLoaderInterface $decorated,

ent\TypeInfo\Type\UnionType;
use Symfony\Component\TypeInfo\Type\WrappingTypeInterface;
use Symfony\Component\TypeInfo\TypeContext\TypeContextFactory;

/**
 * Enhances properties metadata based on properties' generic type.
 *
 *


ge.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Mapping;

use Symfony\Component\TypeInfo\Type;

/**
 * Holds stream reading/writing metadata about a given property.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 */
final class PropertyMetadata
{
    /**
     * @param list<string|\Closure> $valueTransformers
     */
    p

c static function createSynthetic(Type $type, array $valueTransformers = []): self
    {
        return new self(null, $type, $valueTransformers);
    }

    public function getName(): ?string
    {
        return $this->name;
    }

    public function wi

ublic function __construct(
        private ?string $name,
        private Type $type,
        private array $valueTransformers = [],
    ) {
    }

    /**
     * @param list<string|\Closure> $valueTransformers
     */
    publi


he Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\ArgumentResolver\Exception;

final class ResolverNotFoundException extends \RuntimeException
{
    /**
     * @param string[] $alternatives
     */
    public function __construct(string $name, array $alternatives = [])
    {
        $msg = \sprintf('You have requested a n

ternatives) {
            if (1 === \count($alternatives)) {
                $msg .= ' Did you mean this: "';
            } else {
                $msg .= ' Did you mean one of these: "';
            }
            $msg .= implode('", "', $alternatives).'"?

on-existent resolver "%s".', $name);
        if ($al


/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\ArgumentResolver\ValueResolver;

use Symfony\Component\Console\Attribute\Reflection\ReflectionMember;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Stopwatch\Stopwatch;

/**
 * @author Robin Chalas <robin.chalas@gmai

ction resolve(string $argumentName, InputInterface $input, ReflectionMember $member): iterable
    {
        $method = $this->inner::class.'::'.__FUNCTION__;
        $this->stopwatch->start($method, 'command.argument_value_resolver');

        try {

l.com>
 */
final class TraceableValueResolver implements ValueResolverInterface
{
    public function __construct(
        private ValueResolverInterface $inner,
        private Stopwatch $stopwatch,
    ) {
    }

    public fun


buted with this source code.
 */

namespace Symfony\Component\JsonStreamer\Read;

use Psr\Container\ContainerInterface;
use Symfony\Component\Config\ConfigCacheFactoryInterface;
use Symfony\Component\JsonStreamer\DataModel\Read\BackedEnumNode;
use Symfony\Component\JsonStreamer\DataModel\Read\CollectionNode;
use Symfony\Component\JsonStreamer\DataModel\Read\CompositeNode;
use Symfony\Component\JsonStreamer\DataModel\Read\DataModelNodeInterface;
use Symfony\Component\JsonStreamer\DataModel\Read\ObjectNode;
u

ping\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\StreamerDumper;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\BackedEnumType;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInf

se Symfony\Component\JsonStreamer\DataModel\Read\ScalarNode;
use Symfony\Component\JsonStreamer\Exception\RuntimeException;
use Symfony\Component\JsonStreamer\Exception\UnsupportedException;
use Symfony\Component\JsonStreamer\Map


he Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Mapping;

/**
 * Loads properties stream reading/writing metadata for a given $className.
 *
 * These metadata can be used by the DataModelBuilder to create
 * an appropriate ObjectNode.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 */
interface PropertyMet

tring         $className
     * @param array<string, mixed> $options   Implementation-specific options
     * @param array<string, mixed> $context
     *
     * @return array<string, PropertyMetadata>
     */
    public function load(string $className, arr

adataLoaderInterface
{
    /**
     * @param class-s


 This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\Console\Completion\Output;

use Symfony\Component\Console\Completion\CompletionSuggestions;
use Symfony\Component\Console\Output\OutputInterface;

/**
 * @author Guillaume Aveline <guillaume.aveline@pm.me>
 */
class FishCompletionOutput implements Completion

$value->getValue().($value->getDescription() ? "\t".$value->getDescription() : '');
        }
        foreach ($suggestions->getOptionSuggestions() as $option) {
            $values[] = '--'.$option->getName().($option->getDescription() ? "\t".$option->get

OutputInterface
{
    public function write(CompletionSuggestions $suggestions, OutputInterface $output): void
    {
        $values = [];
        foreach ($suggestions->getValueSuggestions() as $value) {
            $values[] =


hp

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Mapping\Read;

use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoaderInterface;

trigger_deprecation('symfony/json-streamer', '8.1', 'The "%s" class is deprecated, Date times are handled as value objects.', DateTimeTypeProper

mplements PropertyMetadataLoaderInterface
{
    public function __construct(
        private PropertyMetadataLoaderInterface $decorated,
    ) {
    }

    public function load(string $className, array $options = [], array $context = []): array
    {

tyMetadataLoader::class);

/**
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @deprecated since Symfony 8.1, Date times are handled as value objects
 *
 * @internal
 */
final class DateTimeTypePropertyMetadataLoader i


 part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Transformer;

use Symfony\Component\JsonStreamer\Exception\InvalidArgumentException;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\Type\BuiltinType;
use Symfony\Component\TypeInfo\TypeIdentifier;

/**
 * Transforms a {@see \DateTimeZone

 ValueObjectTransformerInterface
{
    public function transform(object $object, array $options = []): string
    {
        if (!$object instanceof \DateTimeZone) {
            throw new InvalidArgumentException('The native value must be an instance of "\D

} to a timezone string and vice versa.
 *
 * @author Mathias Arlaud <mathias.arlaud@gmail.com>
 *
 * @implements ValueObjectTransformerInterface<\DateTimeZone, string>
 */
final class DateTimeZoneValueObjectTransformer implements


r\Tests\Fixtures\Model\DummyWithNullableProperties
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithNullableProperties'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        return $instantiator->instantiate(\Symfony\Component\JsonStreamer\Te

\\Enum\\DummyBackedEnum|null']($data['enum']) : '_symfony_missing_value'], static function ($v) {
            return '_symfony_missing_value' !== $v;
        }));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEn

sts\Fixtures\Model\DummyWithNullableProperties::class, \array_filter(['name' => $data['name'] ?? '_symfony_missing_value', 'enum' => \array_key_exists('enum', $data) ? $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures


hp

/**
 * @param array<string, Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes> $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        yield "{";
        $prefix1 = '';
        foreach ($data as $key1 => $value1) {
            $key1 = \substr(\json_encode($key1), 1, -1);
            $prefix2 = '';
            yield "{$prefix1}\"{$key1}\":{{$prefix2}\"@id\":";
            yield \json_encode

= ',';
        }
        yield "}";
    } catch (\JsonException $e) {
        throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException("Cannot encode \"array<string, Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithN

($value1->id, \JSON_THROW_ON_ERROR, 510);
            $prefix2 = ',';
            yield "{$prefix2}\"name\":";
            yield \json_encode($value1->name, \JSON_THROW_ON_ERROR, 510);
            yield "}";
            $prefix1


* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithOtherDummies $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        $prefix1 = '';
        yield "{{$prefix1}\"name\":";
        yield \json_encode($data->name, \JSON_THROW_ON_ERROR, 511);
        $prefix1 = ',';
        yield "{$prefix1}\"otherDummyOne\":";
        $prefix2 = '';
        yield "{{$prefix2}\"@id\":";
        yield \json_encode($data

myTwo\":";
        $prefix2 = '';
        yield "{{$prefix2}\"id\":";
        yield \json_encode($data->otherDummyTwo->id, \JSON_THROW_ON_ERROR, 510);
        $prefix2 = ',';
        yield "{$prefix2}\"name\":";
        yield \json_encode($data->otherDummy

->otherDummyOne->id, \JSON_THROW_ON_ERROR, 510);
        $prefix2 = ',';
        yield "{$prefix2}\"name\":";
        yield \json_encode($data->otherDummyOne->name, \JSON_THROW_ON_ERROR, 510);
        yield "}{$prefix1}\"otherDum


hp

/**
 * @param iterable<int|string, Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy> $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        yield "{";
        $prefix1 = '';
        foreach ($data as $key1 => $value1) {
            $key1 = is_int($key1) ? $key1 : \substr(\json_encode($key1), 1, -1);
            $prefix2 = '';
            yield "{$prefix1}\"{$key1}\":{{$prefix2}\"id\":";

          $prefix1 = ',';
        }
        yield "}";
    } catch (\JsonException $e) {
        throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException("Cannot encode \"iterable<int|string, Symfony\\Component\\JsonStreamer\\Tests\\F

 yield \json_encode($value1->id, \JSON_THROW_ON_ERROR, 510);
            $prefix2 = ',';
            yield "{$prefix2}\"name\":";
            yield \json_encode($value1->name, \JSON_THROW_ON_ERROR, 510);
            yield "}";


s\Model\DummyWithNameAttributes> $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        yield "[";
        $prefix1 = '';
        foreach ($data as $value1) {
            $prefix2 = '';
            yield "{$prefix1}{{$prefix2}\"@id\":";
            yield \json_encode($value1->id, \JSON_THROW_ON_ERROR, 510);
            $prefix2 = ',';
            yield "{$prefix2}\"name\":";
            yield \json_encode($value1->nam

;
            $prefix1 = ',';
        }
        yield "]";
    } catch (\JsonException $e) {
        throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException("Cannot encode \"list<Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Mod

e, \JSON_THROW_ON_ERROR, 510);
            yield "}"


* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedDictDummies $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithNestedDictDummies'] = static function ($data, $depth) use ($transformers, $options, &$generators) {
        if ($depth >= 512) {
            throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueEx

 = \substr(\json_encode($key1), 1, -1);
            yield "{$prefix2}\"{$key1}\":";
            yield from $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithNestedDictDummies']($value1, $depth + 1);
            $prefix2 = ',';

ception('Maximum stack depth exceeded');
        }
        $prefix1 = '';
        yield "{{$prefix1}\"dummies\":";
        yield "{";
        $prefix2 = '';
        foreach ($data->dummies as $key1 => $value1) {
            $key1


* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedListDummies $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithNestedListDummies'] = static function ($data, $depth) use ($transformers, $options, &$generators) {
        if ($depth >= 512) {
            throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueEx

 = is_int($key1) ? $key1 : \substr(\json_encode($key1), 1, -1);
            yield "{$prefix2}\"{$key1}\":";
            yield from $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithNestedListDummies']($value1, $depth + 1);


* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithSyntheticProperties $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        $prefix1 = '';
        yield "{{$prefix1}\"synthetic\":";
        yield \json_encode(Symfony\Component\JsonStreamer\Tests\Fixtures\Mapping\SyntheticPropertyMetadataLoader::true(null, ['_current_object' => $data] + $options), \JSON_THROW_ON_ERROR, 511);
        yield "}";

Exception $e) {
        throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException("Cannot encode \"Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithSyntheticProperties\" to JSON: {$e->getMessage()}.", 0, $e);
    }
};


* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithUnionProperties $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        $prefix1 = '';
        yield "{";
        if (null === $data->value && ($options['include_null_properties'] ?? false)) {
            yield "{$prefix1}\"value\":null";
        }
        if (null !== $data->value) {
            yield "{$prefix1}\"value\":";
            if ($data->v

        yield \json_encode($data->value, \JSON_THROW_ON_ERROR, 511);
            } else {
                throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value.', \get_debug_type($data->value)));

alue instanceof \Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum) {
                yield \json_encode($data->value->value, \JSON_THROW_ON_ERROR, 511);
            } elseif (\is_string($data->value)) {


* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithDateTimes $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        $prefix1 = '';
        yield "{{$prefix1}\"interface\":";
        yield \json_encode($transformers->get('DateTimeInterface')->transform($data->interface, $options), \JSON_THROW_ON_ERROR, 511);
        $prefix1 = ',';
        yield "{$prefix1}\"immutable\":";
        yield \json_encode(

ncode($transformers->get('DateTimeInterface')->transform($data->union, $options), \JSON_THROW_ON_ERROR, 511);
        } elseif (\is_int($data->union)) {
            yield \json_encode($data->union, \JSON_THROW_ON_ERROR, 511);
        } else {
            t

$transformers->get('DateTimeInterface')->transform($data->immutable, $options), \JSON_THROW_ON_ERROR, 511);
        yield "{$prefix1}\"union\":";
        if ($data->union instanceof \DateTimeImmutable) {
            yield \json_e


ony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithValueTransformerAttributes $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        $prefix1 = '';
        yield "{{$prefix1}\"id\":";
        yield \json_encode($transformers->get('Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Transformer\\DoubleIntAndCastToStringValueTransformer')->transform($data->id, ['_current_object' => $data] + $options), \JSON_THROW_O

form($data->active, ['_current_object' => $data] + $options), \JSON_THROW_ON_ERROR, 511);
        yield "{$prefix1}\"name\":";
        yield \json_encode(strtolower($data->name), \JSON_THROW_ON_ERROR, 511);
        yield "{$prefix1}\"range\":";
        yie

N_ERROR, 511);
        $prefix1 = ',';
        yield "{$prefix1}\"active\":";
        yield \json_encode($transformers->get('Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Transformer\\BooleanToStringValueTransformer')->trans


* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\SelfReferencingDummy $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\SelfReferencingDummy'] = static function ($data, $depth) use ($transformers, $options, &$generators) {
        if ($depth >= 512) {
            throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException('Max

  if (null !== $data->self) {
            yield "{$prefix1}\"@self\":";
            yield from $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\SelfReferencingDummy']($data->self, $depth + 1);
        }
        yield "}";
    };
    t

imum stack depth exceeded');
        }
        $prefix1 = '';
        yield "{";
        if (null === $data->self && ($options['include_null_properties'] ?? false)) {
            yield "{$prefix1}\"@self\":null";
        }


* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\SelfReferencingDummyDict $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\SelfReferencingDummyDict'] = static function ($data, $depth) use ($transformers, $options, &$generators) {
        if ($depth >= 512) {
            throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueExcept

tr(\json_encode($key1), 1, -1);
            yield "{$prefix2}\"{$key1}\":";
            yield from $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\SelfReferencingDummyDict']($value1, $depth + 1);
            $prefix2 = ',';
        }

ion('Maximum stack depth exceeded');
        }
        $prefix1 = '';
        yield "{{$prefix1}\"items\":";
        yield "{";
        $prefix2 = '';
        foreach ($data->items as $key1 => $value1) {
            $key1 = \subs


* @param Symfony\Component\JsonStreamer\Tests\Fixtures\Model\SelfReferencingDummyList $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\SelfReferencingDummyList'] = static function ($data, $depth) use ($transformers, $options, &$generators) {
        if ($depth >= 512) {
            throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueExcept

t($key1) ? $key1 : \substr(\json_encode($key1), 1, -1);
            yield "{$prefix2}\"{$key1}\":";
            yield from $generators['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\SelfReferencingDummyList']($value1, $depth + 1);
            $

ion('Maximum stack depth exceeded');
        }
        $prefix1 = '';
        yield "{{$prefix1}\"items\":";
        yield "{";
        $prefix2 = '';
        foreach ($data->items as $key1 => $value1) {
            $key1 = is_in


ony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes|int|list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum> $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        if (\is_array($data)) {
            yield "[";
            $prefix1 = '';
            foreach ($data as $value1) {
                yield "{$prefix1}";
                yield \json_encode($value1->value, \JSON_THROW_ON_

       yield "{{$prefix1}\"@id\":";
            yield \json_encode($data->id, \JSON_THROW_ON_ERROR, 511);
            $prefix1 = ',';
            yield "{$prefix1}\"name\":";
            yield \json_encode($data->name, \JSON_THROW_ON_ERROR, 511);

ERROR, 511);
                $prefix1 = ',';
            }
            yield "]";
        } elseif ($data instanceof \Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes) {
            $prefix1 = '';


pace Symfony\Component\JsonStreamer\Tests\Fixtures\Model;

use Symfony\Component\JsonStreamer\Attribute\ValueTransformer;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Attribute\BooleanStringValueTransformer;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Transformer\DivideStringAndCastToIntValueTransformer;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Transformer\DoubleIntAndCastToStringValueTransformer;

class DummyWithValueTransformerAttributes
{
    #[ValueTransformer(
        nativeToStream

  #[ValueTransformer(nativeToStream: 'strtolower', streamToNative: 'strtoupper')]
    public string $name = 'DUMMY';

    #[ValueTransformer(
        nativeToStream: [self::class, 'concatRange'],
        streamToNative: [self::class, 'explodeRange'],
    )

: DoubleIntAndCastToStringValueTransformer::class,
        streamToNative: DivideStringAndCastToIntValueTransformer::class,
    )]
    public int $id = 1;

    #[BooleanStringValueTransformer]
    public bool $active = false;


 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Mapping;

use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Mapping\GenericTypePropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadata;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoaderInterface;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithGeneric

{
    public function testReplaceGenerics()
    {
        $loader = new GenericTypePropertyMetadataLoader(self::propertyMetadataLoader([
            'foo' => new PropertyMetadata('foo', Type::template('T')),
        ]), new TypeContextFactory(new StringTyp

s;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\TypeContext\TypeContextFactory;
use Symfony\Component\TypeInfo\TypeResolver\StringTypeResolver;

class GenericTypePropertyMetadataLoaderTest extends TestCase


<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Mapping;

use PHPUnit\Framework\TestCase;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadata;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoader;
use Symfony\Component\JsonStreamer\Tests\Fixtures\Model\C

ew PropertyMetadataLoader(TypeResolver::create());

        $this->assertEquals([
            'id' => new PropertyMetadata('id', Type::int()),
            'name' => new PropertyMetadata('name', Type::string()),
        ], $loader->load(ClassicDummy::class)

lassicDummy;
use Symfony\Component\TypeInfo\Type;
use Symfony\Component\TypeInfo\TypeResolver\TypeResolver;

class PropertyMetadataLoaderTest extends TestCase
{
    public function testReadPropertyType()
    {
        $loader = n


* @param list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes>|null $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        if (\is_array($data)) {
            yield "[";
            $prefix1 = '';
            foreach ($data as $value1) {
                $prefix2 = '';
                yield "{$prefix1}{{$prefix2}\"@id\":";
                yield \json_encode($value1->id, \JSON_THROW_ON_ERROR,

    }
            yield "]";
        } elseif (null === $data) {
            yield "null";
        } else {
            throw new \Symfony\Component\JsonStreamer\Exception\UnexpectedValueException(\sprintf('Unexpected "%s" value.', \get_debug_type($data)))

 510);
                $prefix2 = ',';
                yield "{$prefix2}\"name\":";
                yield \json_encode($value1->name, \JSON_THROW_ON_ERROR, 510);
                yield "}";
                $prefix1 = ',';


del\ClassicDummy
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        return $instantiator->instantiate(\Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy::class, \array_fi

', 'name' => $data['name'] ?? '_symfony_missing_value'], static function ($v) {
            return '_symfony_missing_value' !== $v;
        }));
    };
    return $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy'](\Symfony

lter(['id' => $data['id'] ?? '_symfony_missing_value


ay<string, Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['array<string, Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy>'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        $iterable = static function ($data) use ($

       };
        return \iterator_to_array($iterable($data));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        ret

options, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                yield $k => $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy']($v);
            }


nt\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['array<string, Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy>'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::sp

['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy']($stream, $v[0], $v[1]);
            }
        };
        return \iterator_to_array($iterable($stream, $data));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtur

litDict($stream, $offset, $length);
        $iterable = static function ($stream, $data) use ($options, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                yield $k => $providers


rable<int|string, Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['iterable<int|string, Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy>'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        $iterable = static function

           }
        };
        return $iterable($data);
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        return $i

($data) use ($options, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                yield $k => $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy']($v);


* @return list<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['list<Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy>'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        $iterable = static function ($data) use ($optio

  };
        return \iterator_to_array($iterable($data));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        return $

ns, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                yield $k => $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy']($v);
            }


r\Tests\Fixtures\Model\DummyWithNullableProperties
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithNullableProperties'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::sp

sformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                match ($k) {
                    'name' => $object->name = \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]),

litDict($stream, $offset, $length);
        return $instantiator->instantiate(\Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNullableProperties::class, static function ($object) use ($stream, $data, $options, $tran


/**
 * @return Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithSyntheticProperties
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithSyntheticProperties'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \S

n ($object) use ($stream, $data, $options, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                match ($k) {
                    default => null,
                };
            }
        });
    };
    retu

ymfony\Component\JsonStreamer\Read\Splitter::splitDict($stream, $offset, $length);
        return $instantiator->instantiate(\Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithSyntheticProperties::class, static functio


r\Tests\Fixtures\Model\DummyWithUnionProperties
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithUnionProperties'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::splitDic

 $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                match ($k) {
                    'value' => $object->value = $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum|null|string']($stream

t($stream, $offset, $length);
        return $instantiator->instantiate(\Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithUnionProperties::class, static function ($object) use ($stream, $data, $options, $transformers,


r\Tests\Fixtures\Model\DummyWithDateTimes
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithDateTimes'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        return $instantiator->instantiate(\Symfony\Component\JsonStreamer\Tests\Fixtures\Model

) ? $providers['DateTimeImmutable']($data['immutable']) : '_symfony_missing_value', 'union' => \array_key_exists('union', $data) ? $providers['DateTimeImmutable|int']($data['union']) : '_symfony_missing_value'], static function ($v) {
            return '_

\DummyWithDateTimes::class, \array_filter(['interface' => \array_key_exists('interface', $data) ? $providers['DateTimeInterface']($data['interface']) : '_symfony_missing_value', 'immutable' => \array_key_exists('immutable', $data


r\Tests\Fixtures\Model\DummyWithValueTransformerAttributes
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithValueTransformerAttributes'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\R

, $data, $options, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                match ($k) {
                    'id' => $object->id = $transformers->get('Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Transfor

ead\Splitter::splitDict($stream, $offset, $length);
        return $instantiator->instantiate(\Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithValueTransformerAttributes::class, static function ($object) use ($stream


r\Tests\Fixtures\Model\DummyWithNameAttributes|int|list<Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum>
 */
return static function (string|\Stringable $string, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\Instantiator $instantiator, array $options): mixed {
    $providers['list<Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum>'] = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
        $i

um\\DummyBackedEnum']($v);
            }
        };
        return \iterator_to_array($iterable($data));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum'] = static function ($data) {
        return \Symfony\C

terable = static function ($data) use ($options, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                yield $k => $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\En


he Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\JsonStreamer\Tests\Fixtures\Mapping;

use Symfony\Component\JsonStreamer\Mapping\PropertyMetadata;
use Symfony\Component\JsonStreamer\Mapping\PropertyMetadataLoaderInterface;
use Symfony\Component\TypeInfo\Type;

final class SyntheticPropertyMetadataLoader implements PropertyMetad

 $className, array $options = [], array $context = []): array
    {
        return [
            'synthetic' => PropertyMetadata::createSynthetic(Type::true(), [
                self::true(...),
            ]),
        ];
    }

    public static function

ataLoaderInterface
{
    public function load(string


<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNestedList> $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        yield "[";
        $prefix1 = '';
        foreach ($data as $value1) {
            $prefix2 = '';
            yield "{$prefix1}{{$prefix2}\"dummies\":";
            yield "[";
            $prefix3 = '';
            foreach ($value1->dummies as $value2) {
                $prefix4 = '';

{$prefix5}{{$prefix6}\"id\":";
                    yield \json_encode($value3->id, \JSON_THROW_ON_ERROR, 506);
                    $prefix6 = ',';
                    yield "{$prefix6}\"name\":";
                    yield \json_encode($value3->name, \JSON_

          yield "{$prefix3}{{$prefix4}\"dummies\":";
                yield "[";
                $prefix5 = '';
                foreach ($value2->dummies as $value3) {
                    $prefix6 = '';
                    yield "


ent\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum|null $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        if ($data instanceof \Symfony\Component\JsonStreamer\Tests\Fixtures\Enum\DummyBackedEnum) {
            yield \json_encode($data->value, \JSON_THROW_ON_ERROR, 512);
        } elseif (null === $data) {
            yield "null";
        } else {
            throw new \Symfony\Component\JsonStreamer\Exception\

alue.', \get_debug_type($data)));
        }
    } catch (\JsonException $e) {
        throw new \Symfony\Component\JsonStreamer\Exception\NotEncodableValueException("Cannot encode \"Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Enum\\DummyBackedEnum|n


* @param array<string, Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithNameAttributes>|null $data
 */
return static function (mixed $data, \Psr\Container\ContainerInterface $transformers, array $options): \Traversable {
    try {
        if (\is_array($data)) {
            yield "{";
            $prefix1 = '';
            foreach ($data as $key1 => $value1) {
                $key1 = \substr(\json_encode($key1), 1, -1);
                $prefix2 = '';
                yield "{$prefix1}\"{$key1}\":

N_THROW_ON_ERROR, 510);
                yield "}";
                $prefix1 = ',';
            }
            yield "}";
        } elseif (null === $data) {
            yield "null";
        } else {
            throw new \Symfony\Component\JsonStreamer\Exc

{{$prefix2}\"@id\":";
                yield \json_encode($value1->id, \JSON_THROW_ON_ERROR, 510);
                $prefix2 = ',';
                yield "{$prefix2}\"name\":";
                yield \json_encode($value1->name, \JSO


reamer\Tests\Fixtures\Model\ClassicDummy>|null
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['list<Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy>'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::splitList($stre

mponent\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy']($stream, $v[0], $v[1]);
            }
        };
        return \iterator_to_array($iterable($stream, $data));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\Cl

am, $offset, $length);
        $iterable = static function ($stream, $data) use ($options, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                yield $k => $providers['Symfony\\Co


turn static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\DummyWithOtherDummies'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Splitter::splitDict($stream, $offset, $length);
        return $instantiato

 $k => $v) {
                match ($k) {
                    'name' => $object->name = \Symfony\Component\JsonStreamer\Read\Decoder::decodeStream($stream, $v[0], $v[1]),
                    'otherDummyOne' => $object->otherDummyOne = $providers['Symfony\\

r->instantiate(\Symfony\Component\JsonStreamer\Tests\Fixtures\Model\DummyWithOtherDummies::class, static function ($object) use ($stream, $data, $options, $transformers, $instantiator, &$providers) {
            foreach ($data as


t<Symfony\Component\JsonStreamer\Tests\Fixtures\Model\ClassicDummy>
 */
return static function (mixed $stream, \Psr\Container\ContainerInterface $transformers, \Symfony\Component\JsonStreamer\Read\LazyInstantiator $instantiator, array $options): mixed {
    $providers['list<Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy>'] = static function ($stream, $offset, $length) use ($options, $transformers, $instantiator, &$providers) {
        $data = \Symfony\Component\JsonStreamer\Read\Spli

roviders['Symfony\\Component\\JsonStreamer\\Tests\\Fixtures\\Model\\ClassicDummy']($stream, $v[0], $v[1]);
            }
        };
        return \iterator_to_array($iterable($stream, $data));
    };
    $providers['Symfony\\Component\\JsonStreamer\\Tests

tter::splitList($stream, $offset, $length);
        $iterable = static function ($stream, $data) use ($options, $transformers, $instantiator, &$providers) {
            foreach ($data as $k => $v) {
                yield $k => $p