platform/api/symfony/Component/Serializer/Tests/SerializerTest.yaml
2024-09-02 10:44:11 -07:00

1165 lines
62 KiB
YAML

name: SerializerTest
class_comment: null
dependencies:
- name: TestCase
type: class
source: PHPUnit\Framework\TestCase
- name: InvalidTypeException
type: class
source: Symfony\Component\PropertyAccess\Exception\InvalidTypeException
- name: PropertyAccessor
type: class
source: Symfony\Component\PropertyAccess\PropertyAccessor
- name: PhpDocExtractor
type: class
source: Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor
- name: ReflectionExtractor
type: class
source: Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor
- name: PropertyInfoExtractor
type: class
source: Symfony\Component\PropertyInfo\PropertyInfoExtractor
- name: CsvEncoder
type: class
source: Symfony\Component\Serializer\Encoder\CsvEncoder
- name: JsonEncoder
type: class
source: Symfony\Component\Serializer\Encoder\JsonEncoder
- name: XmlEncoder
type: class
source: Symfony\Component\Serializer\Encoder\XmlEncoder
- name: ExtraAttributesException
type: class
source: Symfony\Component\Serializer\Exception\ExtraAttributesException
- name: InvalidArgumentException
type: class
source: Symfony\Component\Serializer\Exception\InvalidArgumentException
- name: LogicException
type: class
source: Symfony\Component\Serializer\Exception\LogicException
- name: NotNormalizableValueException
type: class
source: Symfony\Component\Serializer\Exception\NotNormalizableValueException
- name: PartialDenormalizationException
type: class
source: Symfony\Component\Serializer\Exception\PartialDenormalizationException
- name: UnexpectedValueException
type: class
source: Symfony\Component\Serializer\Exception\UnexpectedValueException
- name: ClassDiscriminatorFromClassMetadata
type: class
source: Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata
- name: ClassDiscriminatorMapping
type: class
source: Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping
- name: ClassMetadata
type: class
source: Symfony\Component\Serializer\Mapping\ClassMetadata
- name: ClassMetadataInterface
type: class
source: Symfony\Component\Serializer\Mapping\ClassMetadataInterface
- name: ClassMetadataFactory
type: class
source: Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory
- name: ClassMetadataFactoryInterface
type: class
source: Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface
- name: AttributeLoader
type: class
source: Symfony\Component\Serializer\Mapping\Loader\AttributeLoader
- name: AbstractNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\AbstractNormalizer
- name: AbstractObjectNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer
- name: ArrayDenormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\ArrayDenormalizer
- name: BackedEnumNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer
- name: CustomNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\CustomNormalizer
- name: DataUriNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\DataUriNormalizer
- name: DateTimeNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\DateTimeNormalizer
- name: DateTimeZoneNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\DateTimeZoneNormalizer
- name: DenormalizerAwareInterface
type: class
source: Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface
- name: DenormalizerInterface
type: class
source: Symfony\Component\Serializer\Normalizer\DenormalizerInterface
- name: GetSetMethodNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer
- name: NormalizerAwareInterface
type: class
source: Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface
- name: NormalizerInterface
type: class
source: Symfony\Component\Serializer\Normalizer\NormalizerInterface
- name: ObjectNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\ObjectNormalizer
- name: PropertyNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\PropertyNormalizer
- name: UidNormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\UidNormalizer
- name: UnwrappingDenormalizer
type: class
source: Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer
- name: Serializer
type: class
source: Symfony\Component\Serializer\Serializer
- name: AbstractDummy
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummy
- name: AbstractDummyFirstChild
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummyFirstChild
- name: AbstractDummySecondChild
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummySecondChild
- name: DenormalizableDummy
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DenormalizableDummy
- name: DummyFirstChildQuux
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DummyFirstChildQuux
- name: DummyMessageInterface
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DummyMessageInterface
- name: DummyMessageNumberOne
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberOne
- name: DummyMessageNumberThree
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberThree
- name: DummyMessageNumberTwo
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberTwo
- name: DummyNullableInt
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DummyNullableInt
- name: DummyObjectWithEnumConstructor
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DummyObjectWithEnumConstructor
- name: DummyObjectWithEnumProperty
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DummyObjectWithEnumProperty
- name: DummyWithObjectOrNull
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\DummyWithObjectOrNull
- name: FalseBuiltInDummy
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\FalseBuiltInDummy
- name: FooImplementationDummy
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\FooImplementationDummy
- name: FooInterfaceDummyDenormalizer
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\FooInterfaceDummyDenormalizer
- name: NormalizableTraversableDummy
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\NormalizableTraversableDummy
- name: ObjectCollectionPropertyDummy
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\ObjectCollectionPropertyDummy
- name: Php74Full
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\Php74Full
- name: Php80WithOptionalConstructorParameter
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\Php80WithOptionalConstructorParameter
- name: Php80WithPromotedTypedConstructor
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\Php80WithPromotedTypedConstructor
- name: TraversableDummy
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\TraversableDummy
- name: TrueBuiltInDummy
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\TrueBuiltInDummy
- name: WithTypedConstructor
type: class
source: Symfony\Component\Serializer\Tests\Fixtures\WithTypedConstructor
- name: TestDenormalizer
type: class
source: Symfony\Component\Serializer\Tests\Normalizer\TestDenormalizer
- name: TestNormalizer
type: class
source: Symfony\Component\Serializer\Tests\Normalizer\TestNormalizer
properties:
- name: map
visibility: public
comment: null
- name: map
visibility: public
comment: null
- name: map
visibility: public
comment: null
- name: map
visibility: public
comment: null
- name: changed
visibility: public
comment: "# @dataProvider provideObjectOrCollectionTests */\n# public function testNormalizeWithCollection(Serializer\
\ $serializer, array $data)\n# {\n# $expected = '{\"a1\":[],\"a2\":{\"k\":\"v\"\
},\"b1\":[],\"b2\":{\"k\":\"v\"},\"c1\":{\"nested\":[]},\"c2\":{\"nested\":{\"\
k\":\"v\"}},\"d1\":{\"nested\":[]},\"d2\":{\"nested\":{\"k\":\"v\"}},\"e1\":{\"\
map\":[]},\"e2\":{\"map\":{\"k\":\"v\"}},\"f1\":{\"map\":[]},\"f2\":{\"map\":{\"\
k\":\"v\"}},\"g1\":{\"list\":[],\"settings\":[]},\"g2\":{\"list\":[\"greg\"],\"\
settings\":[]}}';\n# $this->assertSame($expected, $serializer->serialize($data,\
\ 'json'));\n# }\n# \n# /** @dataProvider provideObjectOrCollectionTests */\n\
# public function testNormalizePreserveEmptyArrayObject(Serializer $serializer,\
\ array $data)\n# {\n# $expected = '{\"a1\":{},\"a2\":{\"k\":\"v\"},\"b1\":[],\"\
b2\":{\"k\":\"v\"},\"c1\":{\"nested\":{}},\"c2\":{\"nested\":{\"k\":\"v\"}},\"\
d1\":{\"nested\":[]},\"d2\":{\"nested\":{\"k\":\"v\"}},\"e1\":{\"map\":[]},\"\
e2\":{\"map\":{\"k\":\"v\"}},\"f1\":{\"map\":{}},\"f2\":{\"map\":{\"k\":\"v\"\
}},\"g1\":{\"list\":{},\"settings\":[]},\"g2\":{\"list\":[\"greg\"],\"settings\"\
:[]}}';\n# $this->assertSame($expected, $serializer->serialize($data, 'json',\
\ [\n# AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS => true,\n# ]));\n# }\n\
# \n# /** @dataProvider provideObjectOrCollectionTests */\n# public function testNormalizeEmptyArrayAsObject(Serializer\
\ $serializer, array $data)\n# {\n# $expected = '{\"a1\":[],\"a2\":{\"k\":\"v\"\
},\"b1\":{},\"b2\":{\"k\":\"v\"},\"c1\":{\"nested\":[]},\"c2\":{\"nested\":{\"\
k\":\"v\"}},\"d1\":{\"nested\":{}},\"d2\":{\"nested\":{\"k\":\"v\"}},\"e1\":{\"\
map\":{}},\"e2\":{\"map\":{\"k\":\"v\"}},\"f1\":{\"map\":[]},\"f2\":{\"map\":{\"\
k\":\"v\"}},\"g1\":{\"list\":[],\"settings\":{}},\"g2\":{\"list\":[\"greg\"],\"\
settings\":{}}}';\n# $this->assertSame($expected, $serializer->serialize($data,\
\ 'json', [\n# Serializer::EMPTY_ARRAY_AS_OBJECT => true,\n# ]));\n# }\n# \n#\
\ /** @dataProvider provideObjectOrCollectionTests */\n# public function testNormalizeEmptyArrayAsObjectAndPreserveEmptyArrayObject(Serializer\
\ $serializer, array $data)\n# {\n# $expected = '{\"a1\":{},\"a2\":{\"k\":\"v\"\
},\"b1\":{},\"b2\":{\"k\":\"v\"},\"c1\":{\"nested\":{}},\"c2\":{\"nested\":{\"\
k\":\"v\"}},\"d1\":{\"nested\":{}},\"d2\":{\"nested\":{\"k\":\"v\"}},\"e1\":{\"\
map\":{}},\"e2\":{\"map\":{\"k\":\"v\"}},\"f1\":{\"map\":{}},\"f2\":{\"map\":{\"\
k\":\"v\"}},\"g1\":{\"list\":{},\"settings\":{}},\"g2\":{\"list\":[\"greg\"],\"\
settings\":{}}}';\n# $this->assertSame($expected, $serializer->serialize($data,\
\ 'json', [\n# Serializer::EMPTY_ARRAY_AS_OBJECT => true,\n# AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS\
\ => true,\n# ]));\n# }\n# \n# public function testNormalizeScalar()\n# {\n# $serializer\
\ = new Serializer([], ['json' => new JsonEncoder()]);\n# \n# $this->assertSame('42',\
\ $serializer->serialize(42, 'json'));\n# $this->assertSame('true', $serializer->serialize(true,\
\ 'json'));\n# $this->assertSame('false', $serializer->serialize(false, 'json'));\n\
# $this->assertSame('3.14', $serializer->serialize(3.14, 'json'));\n# $this->assertSame('3.14',\
\ $serializer->serialize(31.4e-1, 'json'));\n# $this->assertSame('\" spaces \
\ \"', $serializer->serialize(' spaces ', 'json'));\n# $this->assertSame('\"\
@Ca$e%\"', $serializer->serialize('@Ca$e%', 'json'));\n# }\n# \n# public function\
\ testNormalizeScalarArray()\n# {\n# $serializer = new Serializer([], ['json'\
\ => new JsonEncoder()]);\n# \n# $this->assertSame('[42]', $serializer->serialize([42],\
\ 'json'));\n# $this->assertSame('[true,false]', $serializer->serialize([true,\
\ false], 'json'));\n# $this->assertSame('[3.14,3.24]', $serializer->serialize([3.14,\
\ 32.4e-1], 'json'));\n# $this->assertSame('[\" spaces \",\"@Ca$e%\"]', $serializer->serialize(['\
\ spaces ', '@Ca$e%'], 'json'));\n# }\n# \n# public function testDeserializeScalar()\n\
# {\n# $serializer = new Serializer([], ['json' => new JsonEncoder()]);\n# \n\
# $this->assertSame(42, $serializer->deserialize('42', 'int', 'json'));\n# $this->assertTrue($serializer->deserialize('true',\
\ 'bool', 'json'));\n# $this->assertSame(3.14, $serializer->deserialize('3.14',\
\ 'float', 'json'));\n# $this->assertSame(3.14, $serializer->deserialize('31.4e-1',\
\ 'float', 'json'));\n# $this->assertSame(' spaces ', $serializer->deserialize('\"\
\ spaces \"', 'string', 'json'));\n# $this->assertSame('@Ca$e%', $serializer->deserialize('\"\
@Ca$e%\"', 'string', 'json'));\n# }\n# \n# public function testDeserializeLegacyScalarType()\n\
# {\n# $serializer = new Serializer([], ['json' => new JsonEncoder()]);\n# \n\
# $this->expectException(LogicException::class);\n# \n# $serializer->deserialize('42',\
\ 'integer', 'json');\n# }\n# \n# public function testDeserializeScalarTypeToCustomType()\n\
# {\n# $serializer = new Serializer([], ['json' => new JsonEncoder()]);\n# \n\
# $this->expectException(LogicException::class);\n# \n# $serializer->deserialize('\"\
something\"', Foo::class, 'json');\n# }\n# \n# public function testDeserializeNonscalarTypeToScalar()\n\
# {\n# $serializer = new Serializer([], ['json' => new JsonEncoder()]);\n# \n\
# $this->expectException(NotNormalizableValueException::class);\n# \n# $serializer->deserialize('{\"\
foo\":true}', 'string', 'json');\n# }\n# \n# public function testDeserializeInconsistentScalarType()\n\
# {\n# $serializer = new Serializer([], ['json' => new JsonEncoder()]);\n# \n\
# $this->expectException(NotNormalizableValueException::class);\n# \n# $serializer->deserialize('\"\
42\"', 'int', 'json');\n# }\n# \n# public function testDeserializeScalarArray()\n\
# {\n# $serializer = new Serializer([new ArrayDenormalizer()], ['json' => new\
\ JsonEncoder()]);\n# \n# $this->assertSame([42], $serializer->deserialize('[42]',\
\ 'int[]', 'json'));\n# $this->assertSame([true, false], $serializer->deserialize('[true,false]',\
\ 'bool[]', 'json'));\n# $this->assertSame([3.14, 3.24], $serializer->deserialize('[3.14,32.4e-1]',\
\ 'float[]', 'json'));\n# $this->assertSame([' spaces ', '@Ca$e%'], $serializer->deserialize('[\"\
\ spaces \",\"@Ca$e%\"]', 'string[]', 'json'));\n# }\n# \n# public function\
\ testDeserializeInconsistentScalarArray()\n# {\n# $serializer = new Serializer([new\
\ ArrayDenormalizer()], ['json' => new JsonEncoder()]);\n# \n# $this->expectException(NotNormalizableValueException::class);\n\
# \n# $serializer->deserialize('[\"42\"]', 'int[]', 'json');\n# }\n# \n# public\
\ function testDeserializeOnObjectWithObjectCollectionProperty()\n# {\n# $serializer\
\ = new Serializer([new FooInterfaceDummyDenormalizer(), new ObjectNormalizer(null,\
\ null, null, new PhpDocExtractor())], [new JsonEncoder()]);\n# \n# $obj = $serializer->deserialize('{\"\
foo\":[{\"name\":\"bar\"}]}', ObjectCollectionPropertyDummy::class, 'json');\n\
# $this->assertInstanceOf(ObjectCollectionPropertyDummy::class, $obj);\n# \n#\
\ $fooDummyObjects = $obj->getFoo();\n# $this->assertCount(1, $fooDummyObjects);\n\
# \n# $fooDummyObject = $fooDummyObjects[0];\n# $this->assertInstanceOf(FooImplementationDummy::class,\
\ $fooDummyObject);\n# $this->assertSame('bar', $fooDummyObject->name);\n# }\n\
# \n# public function testDeserializeWrappedScalar()\n# {\n# $serializer = new\
\ Serializer([new UnwrappingDenormalizer()], ['json' => new JsonEncoder()]);\n\
# \n# $this->assertSame(42, $serializer->deserialize('{\"wrapper\": 42}', 'int',\
\ 'json', [UnwrappingDenormalizer::UNWRAP_PATH => '[wrapper]']));\n# }\n# \n#\
\ public function testDeserializeNullableIntInXml()\n# {\n# $extractor = new PropertyInfoExtractor([],\
\ [new ReflectionExtractor()]);\n# $serializer = new Serializer([new ObjectNormalizer(null,\
\ null, null, $extractor)], ['xml' => new XmlEncoder()]);\n# \n# $obj = $serializer->deserialize('<?xml\
\ version=\"1.0\" encoding=\"UTF-8\"?><DummyNullableInt><value/></DummyNullableInt>',\
\ DummyNullableInt::class, 'xml');\n# $this->assertInstanceOf(DummyNullableInt::class,\
\ $obj);\n# $this->assertNull($obj->value);\n# }\n# \n# public function testUnionTypeDeserializable()\n\
# {\n# $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());\n\
# $extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);\n\
# $serializer = new Serializer(\n# [\n# new DateTimeNormalizer(),\n# new ObjectNormalizer($classMetadataFactory,\
\ null, null, $extractor, new ClassDiscriminatorFromClassMetadata($classMetadataFactory)),\n\
# ],\n# ['json' => new JsonEncoder()]\n# );\n# \n# $actual = $serializer->deserialize('{\
\ \"changed\": null }', DummyUnionType::class, 'json', [\n# DateTimeNormalizer::FORMAT_KEY\
\ => \\DateTimeinterface::ATOM,\n# ]);\n# \n# $this->assertEquals((new DummyUnionType())->setChanged(null),\
\ $actual, 'Union type denormalization first case failed.');\n# \n# $actual =\
\ $serializer->deserialize('{ \"changed\": \"2022-03-22T16:15:05+0000\" }', DummyUnionType::class,\
\ 'json', [\n# DateTimeNormalizer::FORMAT_KEY => \\DateTimeinterface::ATOM,\n\
# ]);\n# \n# $expectedDateTime = \\DateTimeImmutable::createFromFormat(\\DateTimeinterface::ATOM,\
\ '2022-03-22T16:15:05+0000');\n# $this->assertEquals((new DummyUnionType())->setChanged($expectedDateTime),\
\ $actual, 'Union type denormalization second case failed.');\n# \n# $actual =\
\ $serializer->deserialize('{ \"changed\": false }', DummyUnionType::class, 'json',\
\ [\n# DateTimeNormalizer::FORMAT_KEY => \\DateTimeinterface::ATOM,\n# ]);\n#\
\ \n# $this->assertEquals(new DummyUnionType(), $actual, 'Union type denormalization\
\ third case failed.');\n# }\n# \n# public function testUnionTypeDeserializableWithoutAllowedExtraAttributes()\n\
# {\n# $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());\n\
# $extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);\n\
# $serializer = new Serializer(\n# [\n# new ObjectNormalizer($classMetadataFactory,\
\ null, null, $extractor, new ClassDiscriminatorFromClassMetadata($classMetadataFactory)),\n\
# ],\n# ['json' => new JsonEncoder()]\n# );\n# \n# $actual = $serializer->deserialize('{\
\ \"v\": { \"a\": 0 }}', DummyUnionWithAAndCAndB::class, 'json', [\n# AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES\
\ => false,\n# ]);\n# \n# $this->assertEquals(new DummyUnionWithAAndCAndB(new\
\ DummyATypeForUnion()), $actual);\n# \n# $actual = $serializer->deserialize('{\
\ \"v\": { \"b\": 1 }}', DummyUnionWithAAndCAndB::class, 'json', [\n# AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES\
\ => false,\n# ]);\n# \n# $this->assertEquals(new DummyUnionWithAAndCAndB(new\
\ DummyBTypeForUnion()), $actual);\n# \n# $actual = $serializer->deserialize('{\
\ \"v\": { \"c\": 3 }}', DummyUnionWithAAndCAndB::class, 'json', [\n# AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES\
\ => false,\n# ]);\n# \n# $this->assertEquals(new DummyUnionWithAAndCAndB(new\
\ DummyCTypeForUnion(3)), $actual);\n# \n# $this->expectException(ExtraAttributesException::class);\n\
# $serializer->deserialize('{ \"v\": { \"b\": 1, \"d\": \"i am not allowed\" }}',\
\ DummyUnionWithAAndCAndB::class, 'json', [\n# AbstractNormalizer::ALLOW_EXTRA_ATTRIBUTES\
\ => false,\n# ]);\n# }\n# \n# public function testFalseBuiltInTypes()\n# {\n\
# $extractor = new PropertyInfoExtractor([], [new ReflectionExtractor()]);\n#\
\ $serializer = new Serializer([new ObjectNormalizer(null, null, null, $extractor)],\
\ ['json' => new JsonEncoder()]);\n# \n# $actual = $serializer->deserialize('{\"\
false\":false}', FalseBuiltInDummy::class, 'json');\n# \n# $this->assertEquals(new\
\ FalseBuiltInDummy(), $actual);\n# }\n# \n# public function testTrueBuiltInTypes()\n\
# {\n# $extractor = new PropertyInfoExtractor([], [new ReflectionExtractor()]);\n\
# $serializer = new Serializer([new ObjectNormalizer(null, null, null, $extractor)],\
\ ['json' => new JsonEncoder()]);\n# \n# $actual = $serializer->deserialize('{\"\
true\":true}', TrueBuiltInDummy::class, 'json');\n# \n# $this->assertEquals(new\
\ TrueBuiltInDummy(), $actual);\n# }\n# \n# public function testDeserializeUntypedFormat()\n\
# {\n# $serializer = new Serializer([new ObjectNormalizer(null, null, null, new\
\ PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]))],\
\ ['csv' => new CsvEncoder()]);\n# $actual = $serializer->deserialize('value'.\\\
PHP_EOL.',', DummyWithObjectOrNull::class, 'csv', [CsvEncoder::AS_COLLECTION_KEY\
\ => false]);\n# \n# $this->assertEquals(new DummyWithObjectOrNull(null), $actual);\n\
# }\n# \n# private function serializerWithClassDiscriminator()\n# {\n# $classMetadataFactory\
\ = new ClassMetadataFactory(new AttributeLoader());\n# \n# return new Serializer([new\
\ ObjectNormalizer($classMetadataFactory, null, null, new ReflectionExtractor(),\
\ new ClassDiscriminatorFromClassMetadata($classMetadataFactory))], ['json' =>\
\ new JsonEncoder()]);\n# }\n# \n# public function testDeserializeAndUnwrap()\n\
# {\n# $jsonData = '{\"baz\": {\"foo\": \"bar\", \"inner\": {\"title\": \"value\"\
, \"numbers\": [5,3]}}}';\n# \n# $expectedData = Model::fromArray(['title' =>\
\ 'value', 'numbers' => [5, 3]]);\n# \n# $serializer = new Serializer([new UnwrappingDenormalizer(new\
\ PropertyAccessor()), new ObjectNormalizer()], ['json' => new JsonEncoder()]);\n\
# \n# $this->assertEquals(\n# $expectedData,\n# $serializer->deserialize($jsonData,\
\ __NAMESPACE__.'\\Model', 'json', [UnwrappingDenormalizer::UNWRAP_PATH => '[baz][inner]'])\n\
# );\n# }\n# \n# /**\n# * @dataProvider provideCollectDenormalizationErrors\n\
# */\n# public function testCollectDenormalizationErrors(?ClassMetadataFactory\
\ $classMetadataFactory)\n# {\n# $json = '\n# {\n# \"string\": null,\n# \"int\"\
: null,\n# \"float\": null,\n# \"bool\": null,\n# \"dateTime\": null,\n# \"dateTimeImmutable\"\
: null,\n# \"dateTimeZone\": null,\n# \"splFileInfo\": null,\n# \"uuid\": null,\n\
# \"array\": null,\n# \"collection\": [\n# {\n# \"string\": \"string\"\n# },\n\
# {\n# \"string\": null\n# }\n# ],\n# \"php74FullWithConstructor\": {},\n# \"\
php74FullWithTypedConstructor\": {\n# \"something\": \"not a float\",\n# \"somethingElse\"\
: \"not a bool\"\n# },\n# \"dummyMessage\": {\n# },\n# \"nestedObject\": {\n#\
\ \"int\": \"string\"\n# },\n# \"anotherCollection\": null\n# }';\n# \n# $extractor\
\ = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);\n\
# \n# $serializer = new Serializer(\n# [\n# new ArrayDenormalizer(),\n# new DateTimeNormalizer(),\n\
# new DateTimeZoneNormalizer(),\n# new DataUriNormalizer(),\n# new UidNormalizer(),\n\
# new ObjectNormalizer($classMetadataFactory, null, null, $extractor, $classMetadataFactory\
\ ? new ClassDiscriminatorFromClassMetadata($classMetadataFactory) : null),\n\
# ],\n# ['json' => new JsonEncoder()]\n# );\n# \n# try {\n# $serializer->deserialize($json,\
\ Php74Full::class, 'json', [\n# DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS\
\ => true,\n# ]);\n# \n# $this->fail();\n# } catch (\\Throwable $th) {\n# $this->assertInstanceOf(PartialDenormalizationException::class,\
\ $th);\n# }\n# \n# $this->assertInstanceOf(Php74Full::class, $th->getData());\n\
# \n# $exceptionsAsArray = array_map(fn (NotNormalizableValueException $e): array\
\ => [\n# 'currentType' => $e->getCurrentType(),\n# 'expectedTypes' => $e->getExpectedTypes(),\n\
# 'path' => $e->getPath(),\n# 'useMessageForUser' => $e->canUseMessageForUser(),\n\
# 'message' => $e->getMessage(),\n# ], $th->getErrors());\n# \n# $expected = [\n\
# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'string',\n# ],\n#\
\ 'path' => 'string',\n# 'useMessageForUser' => false,\n# 'message' => 'The type\
\ of the \"string\" attribute for class \"Symfony\\\\Component\\\\Serializer\\\
\\Tests\\\\Fixtures\\\\Php74Full\" must be one of \"string\" (\"null\" given).',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'int',\n# ],\n\
# 'path' => 'int',\n# 'useMessageForUser' => false,\n# 'message' => 'The type\
\ of the \"int\" attribute for class \"Symfony\\\\Component\\\\Serializer\\\\\
Tests\\\\Fixtures\\\\Php74Full\" must be one of \"int\" (\"null\" given).',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'float',\n# ],\n\
# 'path' => 'float',\n# 'useMessageForUser' => false,\n# 'message' => 'The type\
\ of the \"float\" attribute for class \"Symfony\\\\Component\\\\Serializer\\\\\
Tests\\\\Fixtures\\\\Php74Full\" must be one of \"float\" (\"null\" given).',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'bool',\n# ],\n\
# 'path' => 'bool',\n# 'useMessageForUser' => false,\n# 'message' => 'The type\
\ of the \"bool\" attribute for class \"Symfony\\\\Component\\\\Serializer\\\\\
Tests\\\\Fixtures\\\\Php74Full\" must be one of \"bool\" (\"null\" given).',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'string',\n#\
\ ],\n# 'path' => 'dateTime',\n# 'useMessageForUser' => true,\n# 'message' =>\
\ 'The data is either not an string, an empty string, or null; you should pass\
\ a string that can be parsed with the passed format or a valid DateTime string.',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'string',\n#\
\ ],\n# 'path' => 'dateTimeImmutable',\n# 'useMessageForUser' => true,\n# 'message'\
\ => 'The data is either not an string, an empty string, or null; you should pass\
\ a string that can be parsed with the passed format or a valid DateTime string.',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'string',\n#\
\ ],\n# 'path' => 'dateTimeZone',\n# 'useMessageForUser' => true,\n# 'message'\
\ => 'The data is either an empty string or null, you should pass a string that\
\ can be parsed as a DateTimeZone.',\n# ],\n# [\n# 'currentType' => 'null',\n\
# 'expectedTypes' => [\n# 'string',\n# ],\n# 'path' => 'splFileInfo',\n# 'useMessageForUser'\
\ => true,\n# 'message' => 'The provided \"data:\" URI is not valid.',\n# ],\n\
# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'string',\n# ],\n#\
\ 'path' => 'uuid',\n# 'useMessageForUser' => true,\n# 'message' => 'The data\
\ is not a valid \"Symfony\\Component\\Uid\\Uuid\" string representation.',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'array',\n# ],\n\
# 'path' => 'array',\n# 'useMessageForUser' => false,\n# 'message' => 'The type\
\ of the \"array\" attribute for class \"Symfony\\\\Component\\\\Serializer\\\\\
Tests\\\\Fixtures\\\\Php74Full\" must be one of \"array\" (\"null\" given).',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'string',\n#\
\ ],\n# 'path' => 'collection[1].string',\n# 'useMessageForUser' => false,\n#\
\ 'message' => 'The type of the \"string\" attribute for class \"Symfony\\Component\\\
Serializer\\Tests\\Fixtures\\Php74Full\" must be one of \"string\" (\"null\" given).',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'unknown',\n\
# ],\n# 'path' => 'php74FullWithConstructor.constructorArgument',\n# 'useMessageForUser'\
\ => true,\n# 'message' => 'Failed to create object because the class misses the\
\ \"constructorArgument\" property.',\n# ],\n# [\n# 'currentType' => 'string',\n\
# 'expectedTypes' => [\n# 'float',\n# ],\n# 'path' => 'php74FullWithTypedConstructor.something',\n\
# 'useMessageForUser' => false,\n# 'message' => 'The type of the \"something\"\
\ attribute for class \"Symfony\\Component\\Serializer\\Tests\\Fixtures\\Php74FullWithTypedConstructor\"\
\ must be one of \"float\" (\"string\" given).',\n# ],\n# [\n# 'currentType' =>\
\ 'string',\n# 'expectedTypes' => [\n# 'bool',\n# ],\n# 'path' => 'php74FullWithTypedConstructor.somethingElse',\n\
# 'useMessageForUser' => false,\n# 'message' => 'The type of the \"somethingElse\"\
\ attribute for class \"Symfony\\Component\\Serializer\\Tests\\Fixtures\\Php74FullWithTypedConstructor\"\
\ must be one of \"bool\" (\"string\" given).',\n# ],\n# $classMetadataFactory\
\ ?\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'string',\n# ],\n\
# 'path' => 'dummyMessage.type',\n# 'useMessageForUser' => false,\n# 'message'\
\ => 'Type property \"type\" not found for the abstract object \"Symfony\\Component\\\
Serializer\\Tests\\Fixtures\\DummyMessageInterface\".',\n# ] :\n# [\n# 'currentType'\
\ => 'array',\n# 'expectedTypes' => [\n# DummyMessageInterface::class,\n# ],\n\
# 'path' => 'dummyMessage',\n# 'useMessageForUser' => false,\n# 'message' => 'The\
\ type of the \"dummyMessage\" attribute for class \"Symfony\\Component\\Serializer\\\
Tests\\Fixtures\\Php74Full\" must be one of \"Symfony\\Component\\Serializer\\\
Tests\\Fixtures\\DummyMessageInterface\" (\"array\" given).',\n# ],\n# [\n# 'currentType'\
\ => 'string',\n# 'expectedTypes' => [\n# 'int',\n# ],\n# 'path' => 'nestedObject[int]',\n\
# 'useMessageForUser' => true,\n# 'message' => 'The type of the key \"int\" must\
\ be \"int\" (\"string\" given).',\n# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes'\
\ => ['array'],\n# 'path' => 'anotherCollection',\n# 'useMessageForUser' => false,\n\
# 'message' => 'Data expected to be \"Symfony\\Component\\Serializer\\Tests\\\
Fixtures\\Php74Full[]\", \"null\" given.',\n# ],\n# ];\n# \n# $this->assertSame($expected,\
\ $exceptionsAsArray);\n# }\n# \n# /**\n# * @dataProvider provideCollectDenormalizationErrors\n\
# */\n# public function testCollectDenormalizationErrors2(?ClassMetadataFactory\
\ $classMetadataFactory)\n# {\n# $json = '\n# [\n# {\n# \"string\": null\n# },\n\
# {\n# \"string\": null\n# }\n# ]';\n# \n# $extractor = new PropertyInfoExtractor([],\
\ [new PhpDocExtractor(), new ReflectionExtractor()]);\n# \n# $serializer = new\
\ Serializer(\n# [\n# new ArrayDenormalizer(),\n# new ObjectNormalizer($classMetadataFactory,\
\ null, null, $extractor, $classMetadataFactory ? new ClassDiscriminatorFromClassMetadata($classMetadataFactory)\
\ : null),\n# ],\n# ['json' => new JsonEncoder()]\n# );\n# \n# try {\n# $serializer->deserialize($json,\
\ Php74Full::class.'[]', 'json', [\n# DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS\
\ => true,\n# ]);\n# \n# $this->fail();\n# } catch (\\Throwable $th) {\n# $this->assertInstanceOf(PartialDenormalizationException::class,\
\ $th);\n# }\n# \n# $this->assertCount(2, $th->getData());\n# $this->assertInstanceOf(Php74Full::class,\
\ $th->getData()[0]);\n# $this->assertInstanceOf(Php74Full::class, $th->getData()[1]);\n\
# \n# $exceptionsAsArray = array_map(fn (NotNormalizableValueException $e): array\
\ => [\n# 'currentType' => $e->getCurrentType(),\n# 'expectedTypes' => $e->getExpectedTypes(),\n\
# 'path' => $e->getPath(),\n# 'useMessageForUser' => $e->canUseMessageForUser(),\n\
# 'message' => $e->getMessage(),\n# ], $th->getErrors());\n# \n# $expected = [\n\
# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'string',\n# ],\n#\
\ 'path' => '[0].string',\n# 'useMessageForUser' => false,\n# 'message' => 'The\
\ type of the \"string\" attribute for class \"Symfony\\\\Component\\\\Serializer\\\
\\Tests\\\\Fixtures\\\\Php74Full\" must be one of \"string\" (\"null\" given).',\n\
# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes' => [\n# 'string',\n#\
\ ],\n# 'path' => '[1].string',\n# 'useMessageForUser' => false,\n# 'message'\
\ => 'The type of the \"string\" attribute for class \"Symfony\\\\Component\\\\\
Serializer\\\\Tests\\\\Fixtures\\\\Php74Full\" must be one of \"string\" (\"null\"\
\ given).',\n# ],\n# ];\n# \n# $this->assertSame($expected, $exceptionsAsArray);\n\
# }\n# \n# public function testCollectDenormalizationErrorsWithoutTypeExtractor()\n\
# {\n# $json = '\n# {\n# \"string\": [],\n# \"int\": [],\n# \"float\": []\n# }';\n\
# \n# $serializer = new Serializer([new ObjectNormalizer()], ['json' => new JsonEncoder()]);\n\
# \n# try {\n# $serializer->deserialize($json, Php74Full::class, 'json', [\n#\
\ DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS => true,\n# ]);\n# \n\
# $this->fail();\n# } catch (\\Throwable $th) {\n# $this->assertInstanceOf(PartialDenormalizationException::class,\
\ $th);\n# }\n# \n# $this->assertInstanceOf(Php74Full::class, $th->getData());\n\
# \n# $exceptionsAsArray = array_map(fn (NotNormalizableValueException $e): array\
\ => [\n# 'currentType' => $e->getCurrentType(),\n# 'expectedTypes' => $e->getExpectedTypes(),\n\
# 'path' => $e->getPath(),\n# 'useMessageForUser' => $e->canUseMessageForUser(),\n\
# 'message' => $e->getMessage(),\n# ], $th->getErrors());\n# \n# $expected = [\n\
# [\n# 'currentType' => 'array',\n# 'expectedTypes' => [\n# class_exists(InvalidTypeException::class)\
\ ? 'string' : 'unknown',\n# ],\n# 'path' => 'string',\n# 'useMessageForUser'\
\ => false,\n# 'message' => 'Failed to denormalize attribute \"string\" value\
\ for class \"Symfony\\\\Component\\\\Serializer\\\\Tests\\\\Fixtures\\\\Php74Full\"\
: Expected argument of type \"string\", \"array\" given at property path \"string\"\
.',\n# ],\n# [\n# 'currentType' => 'array',\n# 'expectedTypes' => [\n# class_exists(InvalidTypeException::class)\
\ ? 'int' : 'unknown',\n# ],\n# 'path' => 'int',\n# 'useMessageForUser' => false,\n\
# 'message' => 'Failed to denormalize attribute \"int\" value for class \"Symfony\\\
\\Component\\\\Serializer\\\\Tests\\\\Fixtures\\\\Php74Full\": Expected argument\
\ of type \"int\", \"array\" given at property path \"int\".',\n# ],\n# [\n# 'currentType'\
\ => 'array',\n# 'expectedTypes' => [\n# class_exists(InvalidTypeException::class)\
\ ? 'float' : 'unknown',\n# ],\n# 'path' => 'float',\n# 'useMessageForUser' =>\
\ false,\n# 'message' => 'Failed to denormalize attribute \"float\" value for\
\ class \"Symfony\\\\Component\\\\Serializer\\\\Tests\\\\Fixtures\\\\Php74Full\"\
: Expected argument of type \"float\", \"array\" given at property path \"float\"\
.',\n# ],\n# ];\n# \n# $this->assertSame($expected, $exceptionsAsArray);\n# }\n\
# \n# /**\n# * @dataProvider provideCollectDenormalizationErrors\n# */\n# public\
\ function testCollectDenormalizationErrorsWithConstructor(?ClassMetadataFactory\
\ $classMetadataFactory)\n# {\n# $json = '{\"bool\": \"bool\"}';\n# \n# $extractor\
\ = new PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);\n\
# \n# $serializer = new Serializer(\n# [\n# new ObjectNormalizer($classMetadataFactory,\
\ null, null, $extractor, $classMetadataFactory ? new ClassDiscriminatorFromClassMetadata($classMetadataFactory)\
\ : null),\n# ],\n# ['json' => new JsonEncoder()]\n# );\n# \n# try {\n# $serializer->deserialize($json,\
\ Php80WithPromotedTypedConstructor::class, 'json', [\n# DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS\
\ => true,\n# ]);\n# \n# $this->fail();\n# } catch (\\Throwable $th) {\n# $this->assertInstanceOf(PartialDenormalizationException::class,\
\ $th);\n# }\n# \n# $this->assertInstanceOf(Php80WithPromotedTypedConstructor::class,\
\ $th->getData());\n# \n# $exceptionsAsArray = array_map(fn (NotNormalizableValueException\
\ $e): array => [\n# 'currentType' => $e->getCurrentType(),\n# 'expectedTypes'\
\ => $e->getExpectedTypes(),\n# 'path' => $e->getPath(),\n# 'useMessageForUser'\
\ => $e->canUseMessageForUser(),\n# 'message' => $e->getMessage(),\n# ], $th->getErrors());\n\
# \n# $expected = [\n# [\n# 'currentType' => 'string',\n# 'expectedTypes' => [\n\
# 'bool',\n# ],\n# 'path' => 'bool',\n# 'useMessageForUser' => false,\n# 'message'\
\ => 'The type of the \"bool\" attribute for class \"Symfony\\\\Component\\\\\
Serializer\\\\Tests\\\\Fixtures\\\\Php80WithPromotedTypedConstructor\" must be\
\ one of \"bool\" (\"string\" given).',\n# ],\n# [\n# 'currentType' => 'null',\n\
# 'expectedTypes' => [\n# 'string',\n# ],\n# 'path' => 'string',\n# 'useMessageForUser'\
\ => true,\n# 'message' => 'Failed to create object because the class misses the\
\ \"string\" property.',\n# ],\n# [\n# 'currentType' => 'null',\n# 'expectedTypes'\
\ => [\n# 'int',\n# ],\n# 'path' => 'int',\n# 'useMessageForUser' => true,\n#\
\ 'message' => 'Failed to create object because the class misses the \"int\" property.',\n\
# ],\n# ];\n# \n# $this->assertSame($expected, $exceptionsAsArray);\n# }\n# \n\
# public function testCollectDenormalizationErrorsWithInvalidConstructorTypes()\n\
# {\n# $json = '{\"string\": \"some string\", \"bool\": \"bool\", \"int\": true}';\n\
# \n# $extractor = new PropertyInfoExtractor([], [new ReflectionExtractor()]);\n\
# \n# $serializer = new Serializer(\n# [new ObjectNormalizer(null, null, null,\
\ $extractor)],\n# ['json' => new JsonEncoder()]\n# );\n# \n# try {\n# $serializer->deserialize($json,\
\ WithTypedConstructor::class, 'json', [\n# DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS\
\ => true,\n# ]);\n# \n# $this->fail();\n# } catch (\\Throwable $th) {\n# $this->assertInstanceOf(PartialDenormalizationException::class,\
\ $th);\n# }\n# \n# $this->assertInstanceOf(WithTypedConstructor::class, $object\
\ = $th->getData());\n# \n# $this->assertSame('some string', $object->string);\n\
# $this->assertTrue($object->bool);\n# $this->assertSame(1, $object->int);\n#\
\ \n# $exceptionsAsArray = array_map(function (NotNormalizableValueException $e):\
\ array {\n# return [\n# 'currentType' => $e->getCurrentType(),\n# 'expectedTypes'\
\ => $e->getExpectedTypes(),\n# 'path' => $e->getPath(),\n# 'useMessageForUser'\
\ => $e->canUseMessageForUser(),\n# 'message' => $e->getMessage(),\n# ];\n# },\
\ $th->getErrors());\n# \n# $expected = [\n# [\n# 'currentType' => 'string',\n\
# 'expectedTypes' => [\n# 'bool',\n# ],\n# 'path' => 'bool',\n# 'useMessageForUser'\
\ => false,\n# 'message' => 'The type of the \"bool\" attribute for class \"Symfony\\\
Component\\Serializer\\Tests\\Fixtures\\WithTypedConstructor\" must be one of\
\ \"bool\" (\"string\" given).',\n# ],\n# [\n# 'currentType' => 'bool',\n# 'expectedTypes'\
\ => [\n# 'int',\n# ],\n# 'path' => 'int',\n# 'useMessageForUser' => false,\n\
# 'message' => 'The type of the \"int\" attribute for class \"Symfony\\Component\\\
Serializer\\Tests\\Fixtures\\WithTypedConstructor\" must be one of \"int\" (\"\
bool\" given).',\n# ],\n# ];\n# \n# $this->assertSame($expected, $exceptionsAsArray);\n\
# }\n# \n# public function testCollectDenormalizationErrorsWithEnumConstructor()\n\
# {\n# $serializer = new Serializer(\n# [\n# new BackedEnumNormalizer(),\n# new\
\ ObjectNormalizer(),\n# ],\n# ['json' => new JsonEncoder()]\n# );\n# \n# try\
\ {\n# $serializer->deserialize('{\"invalid\": \"GET\"}', DummyObjectWithEnumConstructor::class,\
\ 'json', [\n# DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS => true,\n\
# ]);\n# } catch (\\Throwable $th) {\n# $this->assertInstanceOf(PartialDenormalizationException::class,\
\ $th);\n# }\n# \n# $exceptionsAsArray = array_map(fn (NotNormalizableValueException\
\ $e): array => [\n# 'currentType' => $e->getCurrentType(),\n# 'useMessageForUser'\
\ => $e->canUseMessageForUser(),\n# 'message' => $e->getMessage(),\n# ], $th->getErrors());\n\
# \n# $expected = [\n# [\n# 'currentType' => 'null',\n# 'useMessageForUser' =>\
\ true,\n# 'message' => 'Failed to create object because the class misses the\
\ \"get\" property.',\n# ],\n# ];\n# \n# $this->assertSame($expected, $exceptionsAsArray);\n\
# }\n# \n# public function testCollectDenormalizationErrorsWithWrongPropertyWithoutConstruct()\n\
# {\n# $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());\n\
# $reflectionExtractor = new ReflectionExtractor();\n# $propertyInfoExtractor\
\ = new PropertyInfoExtractor([], [$reflectionExtractor], [], [], []);\n# \n#\
\ $serializer = new Serializer(\n# [\n# new BackedEnumNormalizer(),\n# new ObjectNormalizer($classMetadataFactory,\
\ null, null, $propertyInfoExtractor),\n# ],\n# ['json' => new JsonEncoder()]\n\
# );\n# \n# try {\n# $serializer->deserialize('{\"get\": \"POST\"}', DummyObjectWithEnumProperty::class,\
\ 'json', [\n# DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS => true,\n\
# ]);\n# } catch (\\Throwable $e) {\n# $this->assertInstanceOf(PartialDenormalizationException::class,\
\ $e);\n# }\n# \n# $exceptionsAsArray = array_map(function (NotNormalizableValueException\
\ $e): array {\n# return [\n# 'currentType' => $e->getCurrentType(),\n# 'useMessageForUser'\
\ => $e->canUseMessageForUser(),\n# 'message' => $e->getMessage(),\n# ];\n# },\
\ $e->getErrors());\n# \n# $expected = [\n# [\n# 'currentType' => 'string',\n\
# 'useMessageForUser' => true,\n# 'message' => 'The data must belong to a backed\
\ enumeration of type Symfony\\Component\\Serializer\\Tests\\Fixtures\\StringBackedEnumDummy',\n\
# ],\n# ];\n# \n# $this->assertSame($expected, $exceptionsAsArray);\n# }\n# \n\
# public function testNoCollectDenormalizationErrorsWithWrongEnumOnConstructor()\n\
# {\n# $serializer = new Serializer(\n# [\n# new BackedEnumNormalizer(),\n# new\
\ ObjectNormalizer(),\n# ],\n# ['json' => new JsonEncoder()]\n# );\n# \n# try\
\ {\n# $serializer->deserialize('{\"get\": \"POST\"}', DummyObjectWithEnumConstructor::class,\
\ 'json', [\n# DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS => true,\n\
# ]);\n# } catch (\\Throwable $th) {\n# $this->assertNotInstanceOf(PartialDenormalizationException::class,\
\ $th);\n# $this->assertInstanceOf(InvalidArgumentException::class, $th);\n# }\n\
# }\n# \n# public function testGroupsOnClassSerialization()\n# {\n# $obj = new\
\ Fixtures\\Attributes\\GroupClassDummy();\n# $obj->setFoo('foo');\n# $obj->setBar('bar');\n\
# $obj->setBaz('baz');\n# \n# $serializer = new Serializer(\n# [\n# new ObjectNormalizer(),\n\
# ],\n# [\n# 'json' => new JsonEncoder(),\n# ]\n# );\n# \n# $this->assertSame(\n\
# '{\"foo\":\"foo\",\"bar\":\"bar\",\"baz\":\"baz\"}',\n# $serializer->serialize($obj,\
\ 'json', ['groups' => ['a']])\n# );\n# }\n# \n# public static function provideCollectDenormalizationErrors():\
\ array\n# {\n# return [\n# [null],\n# [new ClassMetadataFactory(new AttributeLoader())],\n\
# ];\n# }\n# \n# public function testSerializerUsesSupportedTypesMethod()\n# {\n\
# $neverCalledNormalizer = $this->createMock(DummyNormalizer::class);\n# $neverCalledNormalizer\n\
# // once for normalization, once for denormalization\n# ->expects($this->exactly(2))\n\
# ->method('getSupportedTypes')\n# ->willReturn([\n# Foo::class => true,\n# Bar::class\
\ => false,\n# ]);\n# \n# $supportedAndCachedNormalizer = $this->createMock(DummyNormalizer::class);\n\
# $supportedAndCachedNormalizer\n# // once for normalization, once for denormalization\n\
# ->expects($this->exactly(2))\n# ->method('getSupportedTypes')\n# ->willReturn([\n\
# Model::class => true,\n# ]);\n# \n# $serializer = new Serializer(\n# [\n# $neverCalledNormalizer,\n\
# $supportedAndCachedNormalizer,\n# new ObjectNormalizer(),\n# ],\n# ['json' =>\
\ new JsonEncoder()]\n# );\n# \n# // Normalization process\n# $neverCalledNormalizer\n\
# ->expects($this->never())\n# ->method('supportsNormalization');\n# $neverCalledNormalizer\n\
# ->expects($this->never())\n# ->method('normalize');\n# \n# $supportedAndCachedNormalizer\n\
# ->expects($this->once())\n# ->method('supportsNormalization')\n# ->willReturn(true);\n\
# $supportedAndCachedNormalizer\n# ->expects($this->exactly(2))\n# ->method('normalize')\n\
# ->willReturn(['foo' => 'bar']);\n# \n# $serializer->normalize(new Model(), 'json');\n\
# $serializer->normalize(new Model(), 'json');\n# \n# // Denormalization pass\n\
# $neverCalledNormalizer\n# ->expects($this->never())\n# ->method('supportsDenormalization');\n\
# $neverCalledNormalizer\n# ->expects($this->never())\n# ->method('denormalize');\n\
# $supportedAndCachedNormalizer\n# ->expects($this->once())\n# ->method('supportsDenormalization')\n\
# ->willReturn(true);\n# $supportedAndCachedNormalizer\n# ->expects($this->exactly(2))\n\
# ->method('denormalize')\n# ->willReturn(new Model());\n# \n# $serializer->denormalize('foo',\
\ Model::class, 'json');\n# $serializer->denormalize('foo', Model::class, 'json');\n\
# }\n# \n# public function testPartialDenormalizationWithMissingConstructorTypes()\n\
# {\n# $json = '{\"one\": \"one string\", \"three\": \"three string\"}';\n# \n\
# $extractor = new PropertyInfoExtractor([], [new ReflectionExtractor()]);\n#\
\ \n# $serializer = new Serializer(\n# [new ObjectNormalizer(null, null, null,\
\ $extractor)],\n# ['json' => new JsonEncoder()]\n# );\n# \n# try {\n# $serializer->deserialize($json,\
\ Php80WithOptionalConstructorParameter::class, 'json', [\n# DenormalizerInterface::COLLECT_DENORMALIZATION_ERRORS\
\ => true,\n# ]);\n# \n# $this->fail();\n# } catch (\\Throwable $th) {\n# $this->assertInstanceOf(PartialDenormalizationException::class,\
\ $th);\n# }\n# \n# $this->assertInstanceOf(Php80WithOptionalConstructorParameter::class,\
\ $object = $th->getData());\n# \n# $this->assertSame('one string', $object->one);\n\
# $this->assertFalse(isset($object->two));\n# $this->assertSame('three string',\
\ $object->three);\n# \n# $exceptionsAsArray = array_map(function (NotNormalizableValueException\
\ $e): array {\n# return [\n# 'currentType' => $e->getCurrentType(),\n# 'expectedTypes'\
\ => $e->getExpectedTypes(),\n# 'path' => $e->getPath(),\n# 'useMessageForUser'\
\ => $e->canUseMessageForUser(),\n# 'message' => $e->getMessage(),\n# ];\n# },\
\ $th->getErrors());\n# \n# $expected = [\n# [\n# 'currentType' => 'null',\n#\
\ 'expectedTypes' => [\n# 'string',\n# ],\n# 'path' => 'two',\n# 'useMessageForUser'\
\ => true,\n# 'message' => 'Failed to create object because the class misses the\
\ \"two\" property.',\n# ],\n# ];\n# \n# $this->assertSame($expected, $exceptionsAsArray);\n\
# }\n# }\n# \n# class Model\n# {\n# private $title;\n# private $numbers;\n# \n\
# public static function fromArray($array)\n# {\n# $model = new self();\n# if\
\ (isset($array['title'])) {\n# $model->setTitle($array['title']);\n# }\n# if\
\ (isset($array['numbers'])) {\n# $model->setNumbers($array['numbers']);\n# }\n\
# \n# return $model;\n# }\n# \n# public function getTitle()\n# {\n# return $this->title;\n\
# }\n# \n# public function setTitle($title)\n# {\n# $this->title = $title;\n#\
\ }\n# \n# public function getNumbers()\n# {\n# return $this->numbers;\n# }\n\
# \n# public function setNumbers($numbers)\n# {\n# $this->numbers = $numbers;\n\
# }\n# \n# public function toArray()\n# {\n# return ['title' => $this->title,\
\ 'numbers' => $this->numbers];\n# }\n# }\n# \n# class Foo\n# {\n# private $bar;\n\
# \n# public function __construct(Bar $bar)\n# {\n# $this->bar = $bar;\n# }\n\
# }\n# \n# class Bar\n# {\n# private $value;\n# \n# public function __construct($value)\n\
# {\n# $this->value = $value;\n# }\n# }\n# \n# class DummyUnionType\n# {\n# /**\n\
# * @var \\DateTimeImmutable|bool|null"
- name: v
visibility: public
comment: "# * @param \\DateTimeImmutable|bool|null\n# *\n# * @return $this\n# */\n\
# public function setChanged($changed): static\n# {\n# $this->changed = $changed;\n\
# \n# return $this;\n# }\n# }\n# \n# class DummyATypeForUnion\n# {\n# public $a\
\ = 0;\n# }\n# \n# class DummyBTypeForUnion\n# {\n# public $b = 1;\n# }\n# \n\
# class DummyCTypeForUnion\n# {\n# public $c = 2;\n# \n# public function __construct($c)\n\
# {\n# $this->c = $c;\n# }\n# }\n# \n# class DummyUnionWithAAndCAndB\n# {\n# /**\
\ @var DummyATypeForUnion|DummyCTypeForUnion|DummyBTypeForUnion"
- name: list
visibility: public
comment: null
- name: settings
visibility: public
comment: null
- name: list
visibility: public
comment: null
methods:
- name: testItThrowsExceptionOnInvalidNormalizer
visibility: public
parameters: []
comment: null
- name: testItThrowsExceptionOnInvalidEncoder
visibility: public
parameters: []
comment: null
- name: testNormalizeNoMatch
visibility: public
parameters: []
comment: null
- name: testNormalizeTraversable
visibility: public
parameters: []
comment: null
- name: testNormalizeGivesPriorityToInterfaceOverTraversable
visibility: public
parameters: []
comment: null
- name: testNormalizeOnDenormalizer
visibility: public
parameters: []
comment: null
- name: testDenormalizeNoMatch
visibility: public
parameters: []
comment: null
- name: testDenormalizeOnObjectThatOnlySupportsDenormalization
visibility: public
parameters: []
comment: null
- name: testDenormalizeOnNormalizer
visibility: public
parameters: []
comment: null
- name: testCustomNormalizerCanNormalizeCollectionsAndScalar
visibility: public
parameters: []
comment: null
- name: testNormalizeWithSupportOnData
visibility: public
parameters: []
comment: null
- name: testDenormalizeWithSupportOnData
visibility: public
parameters: []
comment: null
- name: testSerialize
visibility: public
parameters: []
comment: null
- name: testSerializeScalar
visibility: public
parameters: []
comment: null
- name: testSerializeArrayOfScalars
visibility: public
parameters: []
comment: null
- name: testSerializeEmpty
visibility: public
parameters: []
comment: null
- name: testSerializeNoEncoder
visibility: public
parameters: []
comment: null
- name: testSerializeNoNormalizer
visibility: public
parameters: []
comment: null
- name: testDeserialize
visibility: public
parameters: []
comment: null
- name: testDeserializeUseCache
visibility: public
parameters: []
comment: null
- name: testDeserializeNoNormalizer
visibility: public
parameters: []
comment: null
- name: testDeserializeWrongNormalizer
visibility: public
parameters: []
comment: null
- name: testDeserializeNoEncoder
visibility: public
parameters: []
comment: null
- name: testDeserializeSupported
visibility: public
parameters: []
comment: null
- name: testDeserializeNotSupported
visibility: public
parameters: []
comment: null
- name: testDeserializeNotSupportedMissing
visibility: public
parameters: []
comment: null
- name: testEncode
visibility: public
parameters: []
comment: null
- name: testDecode
visibility: public
parameters: []
comment: null
- name: testSupportsArrayDeserialization
visibility: public
parameters: []
comment: null
- name: testDeserializeArray
visibility: public
parameters: []
comment: null
- name: testNormalizerAware
visibility: public
parameters: []
comment: null
- name: testDenormalizerAware
visibility: public
parameters: []
comment: null
- name: testDeserializeObjectConstructorWithObjectTypeHint
visibility: public
parameters: []
comment: null
- name: testDeserializeAndSerializeAbstractObjectsWithTheClassMetadataDiscriminatorResolver
visibility: public
parameters: []
comment: null
- name: getMetadataFor
visibility: public
parameters:
- name: value
comment: null
- name: hasMetadataFor
visibility: public
parameters:
- name: value
comment: null
- name: testDeserializeAndSerializeInterfacedObjectsWithTheClassMetadataDiscriminatorResolver
visibility: public
parameters: []
comment: null
- name: testDeserializeAndSerializeInterfacedObjectsWithTheClassMetadataDiscriminatorResolverAndGroups
visibility: public
parameters: []
comment: null
- name: testDeserializeAndSerializeNestedInterfacedObjectsWithTheClassMetadataDiscriminator
visibility: public
parameters: []
comment: null
- name: testDeserializeAndSerializeNestedAbstractAndInterfacedObjectsWithTheClassMetadataDiscriminator
visibility: public
parameters: []
comment: null
- name: testExceptionWhenTypeIsNotKnownInDiscriminator
visibility: public
parameters: []
comment: null
- name: testExceptionWhenTypeIsNotInTheBodyToDeserialiaze
visibility: public
parameters: []
comment: null
- name: testNotNormalizableValueExceptionMessageForAResource
visibility: public
parameters: []
comment: null
- name: testNormalizeTransformEmptyArrayObjectToArray
visibility: public
parameters: []
comment: null
- name: provideObjectOrCollectionTests
visibility: public
parameters: []
comment: null
- name: __construct
visibility: public
parameters:
- name: map
comment: null
- name: __construct
visibility: public
parameters:
- name: map
comment: null
- name: testNormalizeWithCollection
visibility: public
parameters:
- name: serializer
- name: data
comment: '# @dataProvider provideObjectOrCollectionTests'
- name: testNormalizePreserveEmptyArrayObject
visibility: public
parameters:
- name: serializer
- name: data
comment: '# @dataProvider provideObjectOrCollectionTests'
- name: testNormalizeEmptyArrayAsObject
visibility: public
parameters:
- name: serializer
- name: data
comment: '# @dataProvider provideObjectOrCollectionTests'
- name: testNormalizeEmptyArrayAsObjectAndPreserveEmptyArrayObject
visibility: public
parameters:
- name: serializer
- name: data
comment: '# @dataProvider provideObjectOrCollectionTests'
- name: testNormalizeScalar
visibility: public
parameters: []
comment: null
- name: testNormalizeScalarArray
visibility: public
parameters: []
comment: null
- name: testDeserializeScalar
visibility: public
parameters: []
comment: null
- name: testDeserializeLegacyScalarType
visibility: public
parameters: []
comment: null
- name: testDeserializeScalarTypeToCustomType
visibility: public
parameters: []
comment: null
- name: testDeserializeNonscalarTypeToScalar
visibility: public
parameters: []
comment: null
- name: testDeserializeInconsistentScalarType
visibility: public
parameters: []
comment: null
- name: testDeserializeScalarArray
visibility: public
parameters: []
comment: null
- name: testDeserializeInconsistentScalarArray
visibility: public
parameters: []
comment: null
- name: testDeserializeOnObjectWithObjectCollectionProperty
visibility: public
parameters: []
comment: null
- name: testDeserializeWrappedScalar
visibility: public
parameters: []
comment: null
- name: testDeserializeNullableIntInXml
visibility: public
parameters: []
comment: null
- name: testUnionTypeDeserializable
visibility: public
parameters: []
comment: null
- name: testUnionTypeDeserializableWithoutAllowedExtraAttributes
visibility: public
parameters: []
comment: null
- name: testFalseBuiltInTypes
visibility: public
parameters: []
comment: null
- name: testTrueBuiltInTypes
visibility: public
parameters: []
comment: null
- name: testDeserializeUntypedFormat
visibility: public
parameters: []
comment: null
- name: serializerWithClassDiscriminator
visibility: private
parameters: []
comment: null
- name: testDeserializeAndUnwrap
visibility: public
parameters: []
comment: null
- name: testCollectDenormalizationErrors
visibility: public
parameters:
- name: classMetadataFactory
comment: '# * @dataProvider provideCollectDenormalizationErrors'
- name: testCollectDenormalizationErrors2
visibility: public
parameters:
- name: classMetadataFactory
comment: '# * @dataProvider provideCollectDenormalizationErrors'
- name: testCollectDenormalizationErrorsWithoutTypeExtractor
visibility: public
parameters: []
comment: null
- name: testCollectDenormalizationErrorsWithConstructor
visibility: public
parameters:
- name: classMetadataFactory
comment: '# * @dataProvider provideCollectDenormalizationErrors'
- name: testCollectDenormalizationErrorsWithInvalidConstructorTypes
visibility: public
parameters: []
comment: null
- name: testCollectDenormalizationErrorsWithEnumConstructor
visibility: public
parameters: []
comment: null
- name: testCollectDenormalizationErrorsWithWrongPropertyWithoutConstruct
visibility: public
parameters: []
comment: null
- name: testNoCollectDenormalizationErrorsWithWrongEnumOnConstructor
visibility: public
parameters: []
comment: null
- name: testGroupsOnClassSerialization
visibility: public
parameters: []
comment: null
- name: provideCollectDenormalizationErrors
visibility: public
parameters: []
comment: null
- name: testSerializerUsesSupportedTypesMethod
visibility: public
parameters: []
comment: null
- name: testPartialDenormalizationWithMissingConstructorTypes
visibility: public
parameters: []
comment: null
- name: fromArray
visibility: public
parameters:
- name: array
comment: null
- name: getTitle
visibility: public
parameters: []
comment: null
- name: setTitle
visibility: public
parameters:
- name: title
comment: null
- name: getNumbers
visibility: public
parameters: []
comment: null
- name: setNumbers
visibility: public
parameters:
- name: numbers
comment: null
- name: toArray
visibility: public
parameters: []
comment: null
- name: __construct
visibility: public
parameters:
- name: bar
comment: null
- name: __construct
visibility: public
parameters:
- name: value
comment: null
- name: setChanged
visibility: public
parameters:
- name: changed
comment: "# * @var \\DateTimeImmutable|bool|null\n# */\n# public $changed = false;\n\
# \n# /**\n# * @param \\DateTimeImmutable|bool|null\n# *\n# * @return $this"
- name: __construct
visibility: public
parameters:
- name: c
comment: null
- name: __construct
visibility: public
parameters:
- name: v
comment: "# @var DummyATypeForUnion|DummyCTypeForUnion|DummyBTypeForUnion */\n#\
\ public $v;\n# \n# /**\n# * @param DummyATypeForUnion|DummyCTypeForUnion|DummyBTypeForUnion\
\ $v"
- name: __construct
visibility: public
parameters:
- name: list
comment: null
- name: __construct
visibility: public
parameters:
- name: list
comment: null
- name: count
visibility: public
parameters: []
comment: null
- name: getIterator
visibility: public
parameters: []
comment: null
- name: getSupportedTypes
visibility: public
parameters:
- name: format
comment: null
traits:
- PHPUnit\Framework\TestCase
- Symfony\Component\PropertyAccess\Exception\InvalidTypeException
- Symfony\Component\PropertyAccess\PropertyAccessor
- Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor
- Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor
- Symfony\Component\PropertyInfo\PropertyInfoExtractor
- Symfony\Component\Serializer\Encoder\CsvEncoder
- Symfony\Component\Serializer\Encoder\JsonEncoder
- Symfony\Component\Serializer\Encoder\XmlEncoder
- Symfony\Component\Serializer\Exception\ExtraAttributesException
- Symfony\Component\Serializer\Exception\InvalidArgumentException
- Symfony\Component\Serializer\Exception\LogicException
- Symfony\Component\Serializer\Exception\NotNormalizableValueException
- Symfony\Component\Serializer\Exception\PartialDenormalizationException
- Symfony\Component\Serializer\Exception\UnexpectedValueException
- Symfony\Component\Serializer\Mapping\ClassDiscriminatorFromClassMetadata
- Symfony\Component\Serializer\Mapping\ClassDiscriminatorMapping
- Symfony\Component\Serializer\Mapping\ClassMetadata
- Symfony\Component\Serializer\Mapping\ClassMetadataInterface
- Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory
- Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface
- Symfony\Component\Serializer\Mapping\Loader\AttributeLoader
- Symfony\Component\Serializer\Normalizer\AbstractNormalizer
- Symfony\Component\Serializer\Normalizer\AbstractObjectNormalizer
- Symfony\Component\Serializer\Normalizer\ArrayDenormalizer
- Symfony\Component\Serializer\Normalizer\BackedEnumNormalizer
- Symfony\Component\Serializer\Normalizer\CustomNormalizer
- Symfony\Component\Serializer\Normalizer\DataUriNormalizer
- Symfony\Component\Serializer\Normalizer\DateTimeNormalizer
- Symfony\Component\Serializer\Normalizer\DateTimeZoneNormalizer
- Symfony\Component\Serializer\Normalizer\DenormalizerAwareInterface
- Symfony\Component\Serializer\Normalizer\DenormalizerInterface
- Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer
- Symfony\Component\Serializer\Normalizer\NormalizerAwareInterface
- Symfony\Component\Serializer\Normalizer\NormalizerInterface
- Symfony\Component\Serializer\Normalizer\ObjectNormalizer
- Symfony\Component\Serializer\Normalizer\PropertyNormalizer
- Symfony\Component\Serializer\Normalizer\UidNormalizer
- Symfony\Component\Serializer\Normalizer\UnwrappingDenormalizer
- Symfony\Component\Serializer\Serializer
- Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummy
- Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummyFirstChild
- Symfony\Component\Serializer\Tests\Fixtures\Attributes\AbstractDummySecondChild
- Symfony\Component\Serializer\Tests\Fixtures\DenormalizableDummy
- Symfony\Component\Serializer\Tests\Fixtures\DummyFirstChildQuux
- Symfony\Component\Serializer\Tests\Fixtures\DummyMessageInterface
- Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberOne
- Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberThree
- Symfony\Component\Serializer\Tests\Fixtures\DummyMessageNumberTwo
- Symfony\Component\Serializer\Tests\Fixtures\DummyNullableInt
- Symfony\Component\Serializer\Tests\Fixtures\DummyObjectWithEnumConstructor
- Symfony\Component\Serializer\Tests\Fixtures\DummyObjectWithEnumProperty
- Symfony\Component\Serializer\Tests\Fixtures\DummyWithObjectOrNull
- Symfony\Component\Serializer\Tests\Fixtures\FalseBuiltInDummy
- Symfony\Component\Serializer\Tests\Fixtures\FooImplementationDummy
- Symfony\Component\Serializer\Tests\Fixtures\FooInterfaceDummyDenormalizer
- Symfony\Component\Serializer\Tests\Fixtures\NormalizableTraversableDummy
- Symfony\Component\Serializer\Tests\Fixtures\ObjectCollectionPropertyDummy
- Symfony\Component\Serializer\Tests\Fixtures\Php74Full
- Symfony\Component\Serializer\Tests\Fixtures\Php80WithOptionalConstructorParameter
- Symfony\Component\Serializer\Tests\Fixtures\Php80WithPromotedTypedConstructor
- Symfony\Component\Serializer\Tests\Fixtures\TraversableDummy
- Symfony\Component\Serializer\Tests\Fixtures\TrueBuiltInDummy
- Symfony\Component\Serializer\Tests\Fixtures\WithTypedConstructor
- Symfony\Component\Serializer\Tests\Normalizer\TestDenormalizer
- Symfony\Component\Serializer\Tests\Normalizer\TestNormalizer
interfaces:
- ClassMetadataFactoryInterface
- NormalizerInterface