1121 lines
53 KiB
YAML
1121 lines
53 KiB
YAML
name: ObjectNormalizerTest
|
|
class_comment: "# * @author K\xE9vin Dunglas <dunglas@gmail.com>"
|
|
dependencies:
|
|
- name: PhpDocParser
|
|
type: class
|
|
source: PHPStan\PhpDocParser\Parser\PhpDocParser
|
|
- name: MockObject
|
|
type: class
|
|
source: PHPUnit\Framework\MockObject\MockObject
|
|
- name: TestCase
|
|
type: class
|
|
source: PHPUnit\Framework\TestCase
|
|
- name: InvalidTypeException
|
|
type: class
|
|
source: Symfony\Component\PropertyAccess\Exception\InvalidTypeException
|
|
- name: PhpDocExtractor
|
|
type: class
|
|
source: Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor
|
|
- name: PhpStanExtractor
|
|
type: class
|
|
source: Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor
|
|
- name: ReflectionExtractor
|
|
type: class
|
|
source: Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor
|
|
- name: PropertyInfoExtractor
|
|
type: class
|
|
source: Symfony\Component\PropertyInfo\PropertyInfoExtractor
|
|
- name: Ignore
|
|
type: class
|
|
source: Symfony\Component\Serializer\Attribute\Ignore
|
|
- name: LogicException
|
|
type: class
|
|
source: Symfony\Component\Serializer\Exception\LogicException
|
|
- name: NotNormalizableValueException
|
|
type: class
|
|
source: Symfony\Component\Serializer\Exception\NotNormalizableValueException
|
|
- name: RuntimeException
|
|
type: class
|
|
source: Symfony\Component\Serializer\Exception\RuntimeException
|
|
- name: UnexpectedValueException
|
|
type: class
|
|
source: Symfony\Component\Serializer\Exception\UnexpectedValueException
|
|
- 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: YamlFileLoader
|
|
type: class
|
|
source: Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader
|
|
- name: AdvancedNameConverterInterface
|
|
type: class
|
|
source: Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface
|
|
- name: CamelCaseToSnakeCaseNameConverter
|
|
type: class
|
|
source: Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter
|
|
- name: MetadataAwareNameConverter
|
|
type: class
|
|
source: Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter
|
|
- name: AbstractNormalizer
|
|
type: class
|
|
source: Symfony\Component\Serializer\Normalizer\AbstractNormalizer
|
|
- name: ArrayDenormalizer
|
|
type: class
|
|
source: Symfony\Component\Serializer\Normalizer\ArrayDenormalizer
|
|
- name: DateTimeNormalizer
|
|
type: class
|
|
source: Symfony\Component\Serializer\Normalizer\DateTimeNormalizer
|
|
- name: NormalizerInterface
|
|
type: class
|
|
source: Symfony\Component\Serializer\Normalizer\NormalizerInterface
|
|
- name: ObjectNormalizer
|
|
type: class
|
|
source: Symfony\Component\Serializer\Normalizer\ObjectNormalizer
|
|
- name: Serializer
|
|
type: class
|
|
source: Symfony\Component\Serializer\Serializer
|
|
- name: SerializerInterface
|
|
type: class
|
|
source: Symfony\Component\Serializer\SerializerInterface
|
|
- name: GroupDummy
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Fixtures\Attributes\GroupDummy
|
|
- name: CircularReferenceDummy
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy
|
|
- name: DummyPrivatePropertyWithoutGetter
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Fixtures\DummyPrivatePropertyWithoutGetter
|
|
- name: OtherSerializedNameDummy
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Fixtures\OtherSerializedNameDummy
|
|
- name: Php74Dummy
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Fixtures\Php74Dummy
|
|
- name: Php74DummyPrivate
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Fixtures\Php74DummyPrivate
|
|
- name: Php80Dummy
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Fixtures\Php80Dummy
|
|
- name: SiblingHolder
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Fixtures\SiblingHolder
|
|
- name: AttributesTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\AttributesTestTrait
|
|
- name: CacheableObjectAttributesTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\CacheableObjectAttributesTestTrait
|
|
- name: CallbacksTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\CallbacksTestTrait
|
|
- name: CircularReferenceTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\CircularReferenceTestTrait
|
|
- name: ConstructorArgumentsTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\ConstructorArgumentsTestTrait
|
|
- name: ContextMetadataTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\ContextMetadataTestTrait
|
|
- name: FilterBoolTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\FilterBoolTestTrait
|
|
- name: GroupsTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\GroupsTestTrait
|
|
- name: IgnoredAttributesTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\IgnoredAttributesTestTrait
|
|
- name: MaxDepthTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\MaxDepthTestTrait
|
|
- name: ObjectDummy
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\ObjectDummy
|
|
- name: ObjectToPopulateTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\ObjectToPopulateTestTrait
|
|
- name: SkipNullValuesTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\SkipNullValuesTestTrait
|
|
- name: SkipUninitializedValuesTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\SkipUninitializedValuesTestTrait
|
|
- name: TypedPropertiesObject
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\TypedPropertiesObject
|
|
- name: TypedPropertiesObjectWithGetters
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\TypedPropertiesObjectWithGetters
|
|
- name: TypeEnforcementTestTrait
|
|
type: class
|
|
source: Symfony\Component\Serializer\Tests\Normalizer\Features\TypeEnforcementTestTrait
|
|
- name: AttributesTestTrait
|
|
type: class
|
|
source: AttributesTestTrait
|
|
- name: CacheableObjectAttributesTestTrait
|
|
type: class
|
|
source: CacheableObjectAttributesTestTrait
|
|
- name: CallbacksTestTrait
|
|
type: class
|
|
source: CallbacksTestTrait
|
|
- name: CircularReferenceTestTrait
|
|
type: class
|
|
source: CircularReferenceTestTrait
|
|
- name: ConstructorArgumentsTestTrait
|
|
type: class
|
|
source: ConstructorArgumentsTestTrait
|
|
- name: ContextMetadataTestTrait
|
|
type: class
|
|
source: ContextMetadataTestTrait
|
|
- name: FilterBoolTestTrait
|
|
type: class
|
|
source: FilterBoolTestTrait
|
|
- name: GroupsTestTrait
|
|
type: class
|
|
source: GroupsTestTrait
|
|
- name: IgnoredAttributesTestTrait
|
|
type: class
|
|
source: IgnoredAttributesTestTrait
|
|
- name: MaxDepthTestTrait
|
|
type: class
|
|
source: MaxDepthTestTrait
|
|
- name: ObjectToPopulateTestTrait
|
|
type: class
|
|
source: ObjectToPopulateTestTrait
|
|
- name: SkipNullValuesTestTrait
|
|
type: class
|
|
source: SkipNullValuesTestTrait
|
|
- name: SkipUninitializedValuesTestTrait
|
|
type: class
|
|
source: SkipUninitializedValuesTestTrait
|
|
- name: TypeEnforcementTestTrait
|
|
type: class
|
|
source: TypeEnforcementTestTrait
|
|
properties:
|
|
- name: foo
|
|
visibility: public
|
|
comment: "# * @author K\xE9vin Dunglas <dunglas@gmail.com>\n# */\n# class ObjectNormalizerTest\
|
|
\ extends TestCase\n# {\n# use AttributesTestTrait;\n# use CacheableObjectAttributesTestTrait;\n\
|
|
# use CallbacksTestTrait;\n# use CircularReferenceTestTrait;\n# use ConstructorArgumentsTestTrait;\n\
|
|
# use ContextMetadataTestTrait;\n# use FilterBoolTestTrait;\n# use GroupsTestTrait;\n\
|
|
# use IgnoredAttributesTestTrait;\n# use MaxDepthTestTrait;\n# use ObjectToPopulateTestTrait;\n\
|
|
# use SkipNullValuesTestTrait;\n# use SkipUninitializedValuesTestTrait;\n# use\
|
|
\ TypeEnforcementTestTrait;\n# \n# private ObjectNormalizer $normalizer;\n# private\
|
|
\ SerializerInterface&NormalizerInterface&MockObject $serializer;\n# \n# protected\
|
|
\ function setUp(): void\n# {\n# $this->createNormalizer();\n# }\n# \n# private\
|
|
\ function createNormalizer(array $defaultContext = [], ?ClassMetadataFactoryInterface\
|
|
\ $classMetadataFactory = null): void\n# {\n# $this->serializer = $this->createMock(ObjectSerializerNormalizer::class);\n\
|
|
# $this->normalizer = new ObjectNormalizer($classMetadataFactory, null, null,\
|
|
\ null, null, null, $defaultContext);\n# $this->normalizer->setSerializer($this->serializer);\n\
|
|
# }\n# \n# public function testNormalize()\n# {\n# $obj = new ObjectDummy();\n\
|
|
# $object = new \\stdClass();\n# $obj->setFoo('foo');\n# $obj->bar = 'bar';\n\
|
|
# $obj->setBaz(true);\n# $obj->setCamelCase('camelcase');\n# $obj->setObject($object);\n\
|
|
# $obj->setGo(true);\n# \n# $this->serializer\n# ->expects($this->once())\n# ->method('normalize')\n\
|
|
# ->with($object, 'any')\n# ->willReturn('string_object')\n# ;\n# \n# $this->assertEquals(\n\
|
|
# [\n# 'foo' => 'foo',\n# 'bar' => 'bar',\n# 'baz' => true,\n# 'fooBar' => 'foobar',\n\
|
|
# 'camelCase' => 'camelcase',\n# 'object' => 'string_object',\n# 'go' => true,\n\
|
|
# ],\n# $this->normalizer->normalize($obj, 'any')\n# );\n# }\n# \n# public function\
|
|
\ testNormalizeObjectWithUninitializedProperties()\n# {\n# $obj = new Php74Dummy();\n\
|
|
# $this->assertEquals(\n# ['initializedProperty' => 'defaultValue'],\n# $this->normalizer->normalize($obj,\
|
|
\ 'any')\n# );\n# }\n# \n# public function testNormalizeObjectWithUnsetProperties()\n\
|
|
# {\n# $obj = new ObjectInner();\n# unset($obj->foo);\n# $this->assertEquals(\n\
|
|
# ['bar' => null],\n# $this->normalizer->normalize($obj, 'any')\n# );\n# }\n#\
|
|
\ \n# public function testNormalizeObjectWithLazyProperties()\n# {\n# $obj = new\
|
|
\ LazyObjectInner();\n# unset($obj->foo);\n# $this->assertEquals(\n# ['foo' =>\
|
|
\ 123, 'bar' => null],\n# $this->normalizer->normalize($obj, 'any')\n# );\n# }\n\
|
|
# \n# public function testNormalizeObjectWithUninitializedPrivateProperties()\n\
|
|
# {\n# $obj = new Php74DummyPrivate();\n# $this->assertEquals(\n# ['initializedProperty'\
|
|
\ => 'defaultValue'],\n# $this->normalizer->normalize($obj, 'any')\n# );\n# }\n\
|
|
# \n# public function testNormalizeObjectWithPrivatePropertyWithoutGetter()\n\
|
|
# {\n# $obj = new DummyPrivatePropertyWithoutGetter();\n# $this->assertEquals(\n\
|
|
# ['bar' => 'bar'],\n# $this->normalizer->normalize($obj, 'any')\n# );\n# }\n\
|
|
# \n# public function testDenormalize()\n# {\n# $obj = $this->normalizer->denormalize(\n\
|
|
# ['foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'],\n# ObjectDummy::class,\n\
|
|
# 'any'\n# );\n# $this->assertEquals('foo', $obj->getFoo());\n# $this->assertEquals('bar',\
|
|
\ $obj->bar);\n# $this->assertTrue($obj->isBaz());\n# }\n# \n# public function\
|
|
\ testDenormalizeEmptyXmlArray()\n# {\n# $normalizer = $this->getDenormalizerForObjectToPopulate();\n\
|
|
# $obj = $normalizer->denormalize(\n# ['bar' => ''],\n# ObjectDummy::class,\n\
|
|
# 'xml'\n# );\n# \n# $this->assertIsArray($obj->bar);\n# $this->assertEmpty($obj->bar);\n\
|
|
# }\n# \n# public function testDenormalizeWithObject()\n# {\n# $data = new \\\
|
|
stdClass();\n# $data->foo = 'foo';\n# $data->bar = 'bar';\n# $data->fooBar = 'foobar';\n\
|
|
# $obj = $this->normalizer->denormalize($data, ObjectDummy::class, 'any');\n#\
|
|
\ $this->assertEquals('foo', $obj->getFoo());\n# $this->assertEquals('bar', $obj->bar);\n\
|
|
# }\n# \n# public function testDenormalizeNull()\n# {\n# $this->assertEquals(new\
|
|
\ ObjectDummy(), $this->normalizer->denormalize(null, ObjectDummy::class));\n\
|
|
# }\n# \n# public function testConstructorDenormalize()\n# {\n# $obj = $this->normalizer->denormalize(\n\
|
|
# ['foo' => 'foo', 'bar' => 'bar', 'baz' => true, 'fooBar' => 'foobar'],\n# ObjectConstructorDummy::class,\
|
|
\ 'any');\n# $this->assertEquals('foo', $obj->getFoo());\n# $this->assertEquals('bar',\
|
|
\ $obj->bar);\n# $this->assertTrue($obj->isBaz());\n# }\n# \n# public function\
|
|
\ testConstructorDenormalizeWithNullArgument()\n# {\n# $obj = $this->normalizer->denormalize(\n\
|
|
# ['foo' => 'foo', 'bar' => null, 'baz' => true],\n# ObjectConstructorDummy::class,\
|
|
\ 'any');\n# $this->assertEquals('foo', $obj->getFoo());\n# $this->assertNull($obj->bar);\n\
|
|
# $this->assertTrue($obj->isBaz());\n# }\n# \n# public function testConstructorDenormalizeWithMissingOptionalArgument()\n\
|
|
# {\n# $obj = $this->normalizer->denormalize(\n# ['foo' => 'test', 'baz' => [1,\
|
|
\ 2, 3]],\n# ObjectConstructorOptionalArgsDummy::class, 'any');\n# $this->assertEquals('test',\
|
|
\ $obj->getFoo());\n# $this->assertEquals([], $obj->bar);\n# $this->assertEquals([1,\
|
|
\ 2, 3], $obj->getBaz());\n# }\n# \n# public function testConstructorDenormalizeWithOptionalDefaultArgument()\n\
|
|
# {\n# $obj = $this->normalizer->denormalize(\n# ['bar' => 'test'],\n# ObjectConstructorArgsWithDefaultValueDummy::class,\
|
|
\ 'any');\n# $this->assertEquals([], $obj->getFoo());\n# $this->assertEquals('test',\
|
|
\ $obj->getBar());\n# }\n# \n# public function testConstructorWithObjectDenormalize()\n\
|
|
# {\n# $data = new \\stdClass();\n# $data->foo = 'foo';\n# $data->bar = 'bar';\n\
|
|
# $data->baz = true;\n# $data->fooBar = 'foobar';\n# $obj = $this->normalizer->denormalize($data,\
|
|
\ ObjectConstructorDummy::class, 'any');\n# $this->assertEquals('foo', $obj->getFoo());\n\
|
|
# $this->assertEquals('bar', $obj->bar);\n# }\n# \n# public function testConstructorWithObjectDenormalizeUsingPropertyInfoExtractor()\n\
|
|
# {\n# $serializer = $this->createMock(ObjectSerializerNormalizer::class);\n#\
|
|
\ $normalizer = new ObjectNormalizer(null, null, null, null, null, null, [], new\
|
|
\ PropertyInfoExtractor());\n# $normalizer->setSerializer($serializer);\n# \n\
|
|
# $data = new \\stdClass();\n# $data->foo = 'foo';\n# $data->bar = 'bar';\n# $data->baz\
|
|
\ = true;\n# $data->fooBar = 'foobar';\n# $obj = $normalizer->denormalize($data,\
|
|
\ ObjectConstructorDummy::class, 'any');\n# $this->assertEquals('foo', $obj->getFoo());\n\
|
|
# $this->assertEquals('bar', $obj->bar);\n# }\n# \n# public function testConstructorWithObjectTypeHintDenormalize()\n\
|
|
# {\n# $data = [\n# 'id' => 10,\n# 'inner' => [\n# 'foo' => 'oof',\n# 'bar' =>\
|
|
\ 'rab',\n# ],\n# ];\n# \n# $normalizer = new ObjectNormalizer();\n# $serializer\
|
|
\ = new Serializer([$normalizer]);\n# $normalizer->setSerializer($serializer);\n\
|
|
# \n# $obj = $normalizer->denormalize($data, DummyWithConstructorObject::class);\n\
|
|
# $this->assertInstanceOf(DummyWithConstructorObject::class, $obj);\n# $this->assertEquals(10,\
|
|
\ $obj->getId());\n# $this->assertInstanceOf(ObjectInner::class, $obj->getInner());\n\
|
|
# $this->assertEquals('oof', $obj->getInner()->foo);\n# $this->assertEquals('rab',\
|
|
\ $obj->getInner()->bar);\n# }\n# \n# public function testConstructorWithUnconstructableNullableObjectTypeHintDenormalize()\n\
|
|
# {\n# $data = [\n# 'id' => 10,\n# 'inner' => null,\n# ];\n# \n# $normalizer =\
|
|
\ new ObjectNormalizer();\n# $serializer = new Serializer([$normalizer]);\n# $normalizer->setSerializer($serializer);\n\
|
|
# \n# $obj = $normalizer->denormalize($data, DummyWithNullableConstructorObject::class);\n\
|
|
# $this->assertInstanceOf(DummyWithNullableConstructorObject::class, $obj);\n\
|
|
# $this->assertEquals(10, $obj->getId());\n# $this->assertNull($obj->getInner());\n\
|
|
# }\n# \n# public function testConstructorWithUnknownObjectTypeHintDenormalize()\n\
|
|
# {\n# $data = [\n# 'id' => 10,\n# 'unknown' => [\n# 'foo' => 'oof',\n# 'bar'\
|
|
\ => 'rab',\n# ],\n# ];\n# \n# $normalizer = new ObjectNormalizer();\n# $serializer\
|
|
\ = new Serializer([$normalizer]);\n# $normalizer->setSerializer($serializer);\n\
|
|
# \n# $this->expectException(RuntimeException::class);\n# $this->expectExceptionMessage('Could\
|
|
\ not determine the class of the parameter \"unknown\".');\n# \n# $normalizer->denormalize($data,\
|
|
\ DummyWithConstructorInexistingObject::class);\n# }\n# \n# // attributes\n# \n\
|
|
# protected function getNormalizerForAttributes(): ObjectNormalizer\n# {\n# $normalizer\
|
|
\ = new ObjectNormalizer();\n# // instantiate a serializer with the normalizer\
|
|
\ to handle normalizing recursive structures\n# new Serializer([$normalizer]);\n\
|
|
# \n# return $normalizer;\n# }\n# \n# protected function getDenormalizerForAttributes():\
|
|
\ ObjectNormalizer\n# {\n# $classMetadataFactory = new ClassMetadataFactory(new\
|
|
\ AttributeLoader());\n# $normalizer = new ObjectNormalizer($classMetadataFactory,\
|
|
\ null, null, new ReflectionExtractor());\n# new Serializer([$normalizer]);\n\
|
|
# \n# return $normalizer;\n# }\n# \n# protected function getNormalizerForFilterBool():\
|
|
\ ObjectNormalizer\n# {\n# return new ObjectNormalizer();\n# }\n# \n# public function\
|
|
\ testAttributesContextDenormalizeConstructor()\n# {\n# $normalizer = new ObjectNormalizer(null,\
|
|
\ null, null, new ReflectionExtractor());\n# $serializer = new Serializer([$normalizer]);\n\
|
|
# \n# $objectInner = new ObjectInner();\n# $objectInner->bar = 'bar';\n# \n# $obj\
|
|
\ = new DummyWithConstructorObjectAndDefaultValue('a', $objectInner);\n# \n# $context\
|
|
\ = ['attributes' => ['inner' => ['bar']]];\n# $this->assertEquals($obj, $serializer->denormalize([\n\
|
|
# 'foo' => 'b',\n# 'inner' => ['foo' => 'foo', 'bar' => 'bar'],\n# ], DummyWithConstructorObjectAndDefaultValue::class,\
|
|
\ null, $context));\n# }\n# \n# public function testNormalizeSameObjectWithDifferentAttributes()\n\
|
|
# {\n# $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());\n\
|
|
# $this->normalizer = new ObjectNormalizer($classMetadataFactory);\n# $serializer\
|
|
\ = new Serializer([$this->normalizer]);\n# $this->normalizer->setSerializer($serializer);\n\
|
|
# \n# $dummy = new ObjectOuter();\n# $dummy->foo = new ObjectInner();\n# $dummy->foo->foo\
|
|
\ = 'foo.foo';\n# $dummy->foo->bar = 'foo.bar';\n# \n# $dummy->bar = new ObjectInner();\n\
|
|
# $dummy->bar->foo = 'bar.foo';\n# $dummy->bar->bar = 'bar.bar';\n# \n# $this->assertEquals([\n\
|
|
# 'foo' => [\n# 'bar' => 'foo.bar',\n# ],\n# 'bar' => [\n# 'foo' => 'bar.foo',\n\
|
|
# ],\n# ], $this->normalizer->normalize($dummy, 'json', [\n# 'attributes' => [\n\
|
|
# 'foo' => ['bar'],\n# 'bar' => ['foo'],\n# ],\n# ]));\n# }\n# \n# // callbacks\n\
|
|
# \n# protected function getNormalizerForCallbacks(): ObjectNormalizer\n# {\n\
|
|
# return new ObjectNormalizer();\n# }\n# \n# protected function getNormalizerForCallbacksWithPropertyTypeExtractor():\
|
|
\ ObjectNormalizer\n# {\n# return new ObjectNormalizer(null, null, null, $this->getCallbackPropertyTypeExtractor());\n\
|
|
# }\n# \n# // circular reference\n# \n# protected function getNormalizerForCircularReference(array\
|
|
\ $defaultContext): ObjectNormalizer\n# {\n# $normalizer = new ObjectNormalizer(null,\
|
|
\ null, null, null, null, null, $defaultContext);\n# new Serializer([$normalizer]);\n\
|
|
# \n# return $normalizer;\n# }\n# \n# protected function getSelfReferencingModel()\n\
|
|
# {\n# return new CircularReferenceDummy();\n# }\n# \n# public function testSiblingReference()\n\
|
|
# {\n# $serializer = new Serializer([$this->normalizer]);\n# $this->normalizer->setSerializer($serializer);\n\
|
|
# \n# $siblingHolder = new SiblingHolder();\n# \n# $expected = [\n# 'sibling0'\
|
|
\ => ['coopTilleuls' => 'Les-Tilleuls.coop'],\n# 'sibling1' => ['coopTilleuls'\
|
|
\ => 'Les-Tilleuls.coop'],\n# 'sibling2' => ['coopTilleuls' => 'Les-Tilleuls.coop'],\n\
|
|
# ];\n# $this->assertEquals($expected, $this->normalizer->normalize($siblingHolder));\n\
|
|
# }\n# \n# // constructor arguments\n# \n# protected function getDenormalizerForConstructArguments():\
|
|
\ ObjectNormalizer\n# {\n# $classMetadataFactory = new ClassMetadataFactory(new\
|
|
\ AttributeLoader());\n# $denormalizer = new ObjectNormalizer($classMetadataFactory,\
|
|
\ new MetadataAwareNameConverter($classMetadataFactory));\n# $serializer = new\
|
|
\ Serializer([$denormalizer]);\n# $denormalizer->setSerializer($serializer);\n\
|
|
# \n# return $denormalizer;\n# }\n# \n# // groups\n# \n# protected function getNormalizerForGroups():\
|
|
\ ObjectNormalizer\n# {\n# $classMetadataFactory = new ClassMetadataFactory(new\
|
|
\ AttributeLoader());\n# $normalizer = new ObjectNormalizer($classMetadataFactory);\n\
|
|
# // instantiate a serializer with the normalizer to handle normalizing recursive\
|
|
\ structures\n# new Serializer([$normalizer]);\n# \n# return $normalizer;\n# }\n\
|
|
# \n# protected function getDenormalizerForGroups(): ObjectNormalizer\n# {\n#\
|
|
\ $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());\n#\
|
|
\ \n# return new ObjectNormalizer($classMetadataFactory);\n# }\n# \n# public function\
|
|
\ testGroupsNormalizeWithNameConverter()\n# {\n# $classMetadataFactory = new ClassMetadataFactory(new\
|
|
\ AttributeLoader());\n# $this->normalizer = new ObjectNormalizer($classMetadataFactory,\
|
|
\ new CamelCaseToSnakeCaseNameConverter());\n# $this->normalizer->setSerializer($this->serializer);\n\
|
|
# \n# $obj = new GroupDummy();\n# $obj->setFooBar('@dunglas');\n# $obj->setSymfony('@coopTilleuls');\n\
|
|
# $obj->setCoopTilleuls('les-tilleuls.coop');\n# \n# $this->assertEquals(\n# [\n\
|
|
# 'bar' => null,\n# 'foo_bar' => '@dunglas',\n# 'symfony' => '@coopTilleuls',\n\
|
|
# 'default' => null,\n# 'class_name' => null,\n# ],\n# $this->normalizer->normalize($obj,\
|
|
\ null, [ObjectNormalizer::GROUPS => ['name_converter']])\n# );\n# }\n# \n# public\
|
|
\ function testGroupsDenormalizeWithNameConverter()\n# {\n# $classMetadataFactory\
|
|
\ = new ClassMetadataFactory(new AttributeLoader());\n# $this->normalizer = new\
|
|
\ ObjectNormalizer($classMetadataFactory, new CamelCaseToSnakeCaseNameConverter());\n\
|
|
# $this->normalizer->setSerializer($this->serializer);\n# \n# $obj = new GroupDummy();\n\
|
|
# $obj->setFooBar('@dunglas');\n# $obj->setSymfony('@coopTilleuls');\n# \n# $this->assertEquals(\n\
|
|
# $obj,\n# $this->normalizer->denormalize([\n# 'bar' => null,\n# 'foo_bar' =>\
|
|
\ '@dunglas',\n# 'symfony' => '@coopTilleuls',\n# 'coop_tilleuls' => 'les-tilleuls.coop',\n\
|
|
# ], GroupDummy::class, null, [ObjectNormalizer::GROUPS => ['name_converter']])\n\
|
|
# );\n# }\n# \n# public function testGroupsDenormalizeWithMetaDataNameConverter()\n\
|
|
# {\n# $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());\n\
|
|
# $this->normalizer = new ObjectNormalizer($classMetadataFactory, new MetadataAwareNameConverter($classMetadataFactory));\n\
|
|
# $this->normalizer->setSerializer($this->serializer);\n# \n# $obj = new OtherSerializedNameDummy();\n\
|
|
# $obj->setBuz('Aldrin');\n# \n# $this->assertEquals(\n# $obj,\n# $this->normalizer->denormalize([\n\
|
|
# 'buz' => 'Aldrin',\n# ], 'Symfony\\Component\\Serializer\\Tests\\Fixtures\\\
|
|
OtherSerializedNameDummy', null, [ObjectNormalizer::GROUPS => ['a']])\n# );\n\
|
|
# }\n# \n# // ignored attributes\n# \n# protected function getNormalizerForIgnoredAttributes():\
|
|
\ ObjectNormalizer\n# {\n# $normalizer = new ObjectNormalizer();\n# // instantiate\
|
|
\ a serializer with the normalizer to handle normalizing recursive structures\n\
|
|
# new Serializer([$normalizer]);\n# \n# return $normalizer;\n# }\n# \n# protected\
|
|
\ function getDenormalizerForIgnoredAttributes(): ObjectNormalizer\n# {\n# $classMetadataFactory\
|
|
\ = new ClassMetadataFactory(new AttributeLoader());\n# $normalizer = new ObjectNormalizer($classMetadataFactory,\
|
|
\ null, null, new ReflectionExtractor());\n# new Serializer([$normalizer]);\n\
|
|
# \n# return $normalizer;\n# }\n# \n# // max depth\n# \n# protected function getNormalizerForMaxDepth():\
|
|
\ ObjectNormalizer\n# {\n# $classMetadataFactory = new ClassMetadataFactory(new\
|
|
\ AttributeLoader());\n# $normalizer = new ObjectNormalizer($classMetadataFactory);\n\
|
|
# $serializer = new Serializer([$normalizer]);\n# $normalizer->setSerializer($serializer);\n\
|
|
# \n# return $normalizer;\n# }\n# \n# // object to populate\n# \n# protected function\
|
|
\ getDenormalizerForObjectToPopulate(): ObjectNormalizer\n# {\n# $classMetadataFactory\
|
|
\ = new ClassMetadataFactory(new AttributeLoader());\n# $normalizer = new ObjectNormalizer($classMetadataFactory,\
|
|
\ null, null, new PhpDocExtractor());\n# new Serializer([$normalizer]);\n# \n\
|
|
# return $normalizer;\n# }\n# \n# // skip null\n# \n# protected function getNormalizerForSkipNullValues():\
|
|
\ ObjectNormalizer\n# {\n# return new ObjectNormalizer();\n# }\n# \n# // skip\
|
|
\ uninitialized\n# \n# protected function getNormalizerForSkipUninitializedValues():\
|
|
\ ObjectNormalizer\n# {\n# $classMetadataFactory = new ClassMetadataFactory(new\
|
|
\ AttributeLoader());\n# \n# return new ObjectNormalizer($classMetadataFactory);\n\
|
|
# }\n# \n# protected function getObjectCollectionWithExpectedArray(): array\n\
|
|
# {\n# $typedPropsObject = new TypedPropertiesObject();\n# $typedPropsObject->unInitialized\
|
|
\ = 'value2';\n# \n# $collection = [\n# new TypedPropertiesObject(),\n# $typedPropsObject,\n\
|
|
# new TypedPropertiesObjectWithGetters(),\n# (new TypedPropertiesObjectWithGetters())->setUninitialized('value2'),\n\
|
|
# ];\n# \n# $expectedArrays = [\n# ['initialized' => 'value', 'initialized2' =>\
|
|
\ 'value'],\n# ['unInitialized' => 'value2', 'initialized' => 'value', 'initialized2'\
|
|
\ => 'value'],\n# ['initialized' => 'value', 'initialized2' => 'value'],\n# ['unInitialized'\
|
|
\ => 'value2', 'initialized' => 'value', 'initialized2' => 'value'],\n# ];\n#\
|
|
\ \n# return [$collection, $expectedArrays];\n# }\n# \n# protected function getNormalizerForCacheableObjectAttributesTest():\
|
|
\ ObjectNormalizer\n# {\n# return new ObjectNormalizer();\n# }\n# \n# // type\
|
|
\ enforcement\n# \n# protected function getDenormalizerForTypeEnforcement(): ObjectNormalizer\n\
|
|
# {\n# $extractor = new PropertyInfoExtractor([], [new PhpDocExtractor(), new\
|
|
\ ReflectionExtractor()]);\n# $normalizer = new ObjectNormalizer(null, null, null,\
|
|
\ $extractor);\n# new Serializer([new ArrayDenormalizer(), $normalizer]);\n# \n\
|
|
# return $normalizer;\n# }\n# \n# public function testUnableToNormalizeObjectAttribute()\n\
|
|
# {\n# $serializer = $this->createMock(SerializerInterface::class);\n# $this->normalizer->setSerializer($serializer);\n\
|
|
# \n# $obj = new ObjectDummy();\n# $object = new \\stdClass();\n# $obj->setObject($object);\n\
|
|
# \n# $this->expectException(LogicException::class);\n# $this->expectExceptionMessage('Cannot\
|
|
\ normalize attribute \"object\" because the injected serializer is not a normalizer');\n\
|
|
# \n# $this->normalizer->normalize($obj, 'any');\n# }\n# \n# public function testDenormalizeNonExistingAttribute()\n\
|
|
# {\n# $this->assertEquals(\n# new ObjectDummy(),\n# $this->normalizer->denormalize(['non_existing'\
|
|
\ => true], ObjectDummy::class)\n# );\n# }\n# \n# public function testNoTraversableSupport()\n\
|
|
# {\n# $this->assertFalse($this->normalizer->supportsNormalization(new \\ArrayObject()));\n\
|
|
# }\n# \n# public function testNormalizeStatic()\n# {\n# $this->assertEquals(['foo'\
|
|
\ => 'K'], $this->normalizer->normalize(new ObjectWithStaticPropertiesAndMethods()));\n\
|
|
# }\n# \n# public function testNormalizeUpperCaseAttributes()\n# {\n# $this->assertEquals(['Foo'\
|
|
\ => 'Foo', 'Bar' => 'BarBar'], $this->normalizer->normalize(new ObjectWithUpperCaseAttributeNames()));\n\
|
|
# }\n# \n# public function testNormalizeNotSerializableContext()\n# {\n# $objectDummy\
|
|
\ = new ObjectDummy();\n# $expected = [\n# 'foo' => null,\n# 'baz' => null,\n\
|
|
# 'fooBar' => '',\n# 'camelCase' => null,\n# 'object' => null,\n# 'bar' => null,\n\
|
|
# 'go' => null,\n# ];\n# \n# $this->assertEquals($expected, $this->normalizer->normalize($objectDummy,\
|
|
\ null, ['not_serializable' => function () {\n# }]));\n# }\n# \n# public function\
|
|
\ testThrowUnexpectedValueException()\n# {\n# $this->expectException(UnexpectedValueException::class);\n\
|
|
# $this->normalizer->denormalize(['foo' => 'bar'], ObjectTypeHinted::class);\n\
|
|
# }\n# \n# public function testDenomalizeRecursive()\n# {\n# $extractor = new\
|
|
\ PropertyInfoExtractor([], [new PhpDocExtractor(), new ReflectionExtractor()]);\n\
|
|
# $normalizer = new ObjectNormalizer(null, null, null, $extractor);\n# $serializer\
|
|
\ = new Serializer([new ArrayDenormalizer(), new DateTimeNormalizer(), $normalizer]);\n\
|
|
# \n# $obj = $serializer->denormalize([\n# 'inner' => ['foo' => 'foo', 'bar' =>\
|
|
\ 'bar'],\n# 'date' => '1988/01/21',\n# 'inners' => [['foo' => 1], ['foo' => 2]],\n\
|
|
# ], ObjectOuter::class);\n# \n# $this->assertSame('foo', $obj->getInner()->foo);\n\
|
|
# $this->assertSame('bar', $obj->getInner()->bar);\n# $this->assertSame('1988-01-21',\
|
|
\ $obj->getDate()->format('Y-m-d'));\n# $this->assertSame(1, $obj->getInners()[0]->foo);\n\
|
|
# $this->assertSame(2, $obj->getInners()[1]->foo);\n# }\n# \n# public function\
|
|
\ testAcceptJsonNumber()\n# {\n# $extractor = new PropertyInfoExtractor([], [new\
|
|
\ PhpDocExtractor(), new ReflectionExtractor()]);\n# $normalizer = new ObjectNormalizer(null,\
|
|
\ null, null, $extractor);\n# $serializer = new Serializer([new ArrayDenormalizer(),\
|
|
\ new DateTimeNormalizer(), $normalizer]);\n# \n# $this->assertSame(10.0, $serializer->denormalize(['number'\
|
|
\ => 10], JsonNumber::class, 'json')->number);\n# $this->assertSame(10.0, $serializer->denormalize(['number'\
|
|
\ => 10], JsonNumber::class, 'jsonld')->number);\n# }\n# \n# public function testDoesntHaveIssuesWithUnionConstTypes()\n\
|
|
# {\n# if (!class_exists(PhpStanExtractor::class) || !class_exists(PhpDocParser::class))\
|
|
\ {\n# $this->markTestSkipped('phpstan/phpdoc-parser required for this test');\n\
|
|
# }\n# \n# $extractor = new PropertyInfoExtractor([], [new PhpStanExtractor(),\
|
|
\ new PhpDocExtractor(), new ReflectionExtractor()]);\n# $normalizer = new ObjectNormalizer(null,\
|
|
\ null, null, $extractor);\n# $serializer = new Serializer([new ArrayDenormalizer(),\
|
|
\ new DateTimeNormalizer(), $normalizer]);\n# \n# $this->assertSame('bar', $serializer->denormalize(['foo'\
|
|
\ => 'bar'], (new class {\n# /** @var self::*|null"
|
|
- name: inner
|
|
visibility: private
|
|
comment: "# @var Php80Dummy $object */\n# $object = $serializer->denormalize(['canBeFalseOrString'\
|
|
\ => false], Php80Dummy::class);\n# \n# // then the attribute that declared false\
|
|
\ was filled correctly\n# $this->assertFalse($object->canBeFalseOrString);\n#\
|
|
\ }\n# \n# public function testAdvancedNameConverter()\n# {\n# $nameConverter\
|
|
\ = new class implements AdvancedNameConverterInterface {\n# public function normalize(string\
|
|
\ $propertyName, ?string $class = null, ?string $format = null, array $context\
|
|
\ = []): string\n# {\n# return \\sprintf('%s-%s-%s-%s', $propertyName, $class,\
|
|
\ $format, $context['foo']);\n# }\n# \n# public function denormalize(string $propertyName,\
|
|
\ ?string $class = null, ?string $format = null, array $context = []): string\n\
|
|
# {\n# return \\sprintf('%s-%s-%s-%s', $propertyName, $class, $format, $context['foo']);\n\
|
|
# }\n# };\n# \n# $normalizer = new ObjectNormalizer(null, $nameConverter);\n#\
|
|
\ $this->assertArrayHasKey('foo-Symfony\\Component\\Serializer\\Tests\\Normalizer\\\
|
|
Features\\ObjectDummy-json-bar', $normalizer->normalize(new ObjectDummy(), 'json',\
|
|
\ ['foo' => 'bar']));\n# }\n# \n# public function testDefaultObjectClassResolver()\n\
|
|
# {\n# $normalizer = new ObjectNormalizer();\n# \n# $obj = new ObjectDummy();\n\
|
|
# $obj->setFoo('foo');\n# $obj->bar = 'bar';\n# $obj->setBaz(true);\n# $obj->setCamelCase('camelcase');\n\
|
|
# $obj->unwantedProperty = 'notwanted';\n# $obj->setGo(false);\n# \n# $this->assertEquals(\n\
|
|
# [\n# 'foo' => 'foo',\n# 'bar' => 'bar',\n# 'baz' => true,\n# 'fooBar' => 'foobar',\n\
|
|
# 'camelCase' => 'camelcase',\n# 'object' => null,\n# 'go' => false,\n# ],\n#\
|
|
\ $normalizer->normalize($obj, 'any')\n# );\n# }\n# \n# public function testObjectClassResolver()\n\
|
|
# {\n# $classResolver = fn ($object) => ObjectDummy::class;\n# \n# $normalizer\
|
|
\ = new ObjectNormalizer(null, null, null, null, null, $classResolver);\n# \n\
|
|
# $obj = new ProxyObjectDummy();\n# $obj->setFoo('foo');\n# $obj->bar = 'bar';\n\
|
|
# $obj->setBaz(true);\n# $obj->setCamelCase('camelcase');\n# $obj->unwantedProperty\
|
|
\ = 'notwanted';\n# \n# $this->assertEquals(\n# [\n# 'foo' => 'foo',\n# 'bar'\
|
|
\ => 'bar',\n# 'baz' => true,\n# 'fooBar' => 'foobar',\n# 'camelCase' => 'camelcase',\n\
|
|
# 'object' => null,\n# 'go' => null,\n# ],\n# $normalizer->normalize($obj, 'any')\n\
|
|
# );\n# }\n# \n# public function testNormalizeStdClass()\n# {\n# $o1 = new \\\
|
|
stdClass();\n# $o1->foo = 'f';\n# $o1->bar = 'b';\n# \n# $this->assertSame(['foo'\
|
|
\ => 'f', 'bar' => 'b'], $this->normalizer->normalize($o1));\n# \n# $o2 = new\
|
|
\ \\stdClass();\n# $o2->baz = 'baz';\n# \n# $this->assertSame(['baz' => 'baz'],\
|
|
\ $this->normalizer->normalize($o2));\n# }\n# \n# public function testNotNormalizableValueInvalidType()\n\
|
|
# {\n# if (!class_exists(InvalidTypeException::class)) {\n# $this->markTestSkipped('Skipping\
|
|
\ test as the improvements on PropertyAccess are required.');\n# }\n# \n# $this->expectException(NotNormalizableValueException::class);\n\
|
|
# $this->expectExceptionMessage('Expected argument of type \"string\", \"array\"\
|
|
\ given at property path \"initialized\"');\n# \n# try {\n# $this->normalizer->denormalize(['initialized'\
|
|
\ => ['not a string']], TypedPropertiesObject::class, 'array');\n# } catch (NotNormalizableValueException\
|
|
\ $e) {\n# $this->assertSame(['string'], $e->getExpectedTypes());\n# \n# throw\
|
|
\ $e;\n# }\n# }\n# \n# public function testNormalizeWithoutSerializerSet()\n#\
|
|
\ {\n# $normalizer = new ObjectNormalizer(new ClassMetadataFactory(new AttributeLoader()));\n\
|
|
# \n# $this->expectException(LogicException::class);\n# $this->expectExceptionMessage('Cannot\
|
|
\ normalize attribute \"foo\" because the injected serializer is not a normalizer.');\n\
|
|
# \n# $normalizer->normalize(new ObjectConstructorDummy([], [], []));\n# }\n#\
|
|
\ \n# public function testNormalizeWithIgnoreAttributeAndPrivateProperties()\n\
|
|
# {\n# $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());\n\
|
|
# $normalizer = new ObjectNormalizer($classMetadataFactory);\n# \n# $this->assertSame(['foo'\
|
|
\ => 'foo'], $normalizer->normalize(new ObjectDummyWithIgnoreAttributeAndPrivateProperty()));\n\
|
|
# }\n# \n# public function testDenormalizeWithIgnoreAttributeAndPrivateProperties()\n\
|
|
# {\n# $classMetadataFactory = new ClassMetadataFactory(new AttributeLoader());\n\
|
|
# $normalizer = new ObjectNormalizer($classMetadataFactory);\n# \n# $obj = $normalizer->denormalize([\n\
|
|
# 'foo' => 'set',\n# 'ignore' => 'set',\n# 'private' => 'set',\n# ], ObjectDummyWithIgnoreAttributeAndPrivateProperty::class);\n\
|
|
# \n# $expected = new ObjectDummyWithIgnoreAttributeAndPrivateProperty();\n# $expected->foo\
|
|
\ = 'set';\n# \n# $this->assertEquals($expected, $obj);\n# }\n# \n# public function\
|
|
\ testNormalizeWithPropertyPath()\n# {\n# $classMetadataFactory = new ClassMetadataFactory(new\
|
|
\ YamlFileLoader(__DIR__.'/../Fixtures/property-path-mapping.yaml'));\n# $normalizer\
|
|
\ = new ObjectNormalizer($classMetadataFactory, new MetadataAwareNameConverter($classMetadataFactory));\n\
|
|
# \n# $dummyInner = new ObjectInner();\n# $dummyInner->foo = 'foo';\n# $dummy\
|
|
\ = new ObjectOuter();\n# $dummy->setInner($dummyInner);\n# \n# $this->assertSame(['inner_foo'\
|
|
\ => 'foo'], $normalizer->normalize($dummy, 'json', ['groups' => 'read']));\n\
|
|
# }\n# \n# public function testDenormalizeWithPropertyPath()\n# {\n# $classMetadataFactory\
|
|
\ = new ClassMetadataFactory(new YamlFileLoader(__DIR__.'/../Fixtures/property-path-mapping.yaml'));\n\
|
|
# $normalizer = new ObjectNormalizer($classMetadataFactory, new MetadataAwareNameConverter($classMetadataFactory));\n\
|
|
# \n# $dummy = new ObjectOuter();\n# $dummy->setInner(new ObjectInner());\n# \n\
|
|
# $obj = $normalizer->denormalize(['inner_foo' => 'foo'], ObjectOuter::class,\
|
|
\ 'json', [\n# 'object_to_populate' => $dummy,\n# 'groups' => 'read',\n# ]);\n\
|
|
# \n# $expectedInner = new ObjectInner();\n# $expectedInner->foo = 'foo';\n# $expected\
|
|
\ = new ObjectOuter();\n# $expected->setInner($expectedInner);\n# \n# $this->assertEquals($expected,\
|
|
\ $obj);\n# }\n# }\n# \n# class ProxyObjectDummy extends ObjectDummy\n# {\n# public\
|
|
\ $unwantedProperty;\n# }\n# \n# class ObjectConstructorDummy\n# {\n# protected\
|
|
\ $foo;\n# public $bar;\n# private $baz;\n# \n# public function __construct($foo,\
|
|
\ $bar, $baz)\n# {\n# $this->foo = $foo;\n# $this->bar = $bar;\n# $this->baz =\
|
|
\ $baz;\n# }\n# \n# public function getFoo()\n# {\n# return $this->foo;\n# }\n\
|
|
# \n# public function isBaz()\n# {\n# return $this->baz;\n# }\n# \n# public function\
|
|
\ otherMethod()\n# {\n# throw new \\RuntimeException('Dummy::otherMethod() should\
|
|
\ not be called');\n# }\n# }\n# \n# abstract class ObjectSerializerNormalizer\
|
|
\ implements SerializerInterface, NormalizerInterface\n# {\n# }\n# \n# class ObjectConstructorOptionalArgsDummy\n\
|
|
# {\n# protected $foo;\n# public $bar;\n# private $baz;\n# \n# public function\
|
|
\ __construct($foo, $bar = [], $baz = [])\n# {\n# $this->foo = $foo;\n# $this->bar\
|
|
\ = $bar;\n# $this->baz = $baz;\n# }\n# \n# public function getFoo()\n# {\n# return\
|
|
\ $this->foo;\n# }\n# \n# public function getBaz()\n# {\n# return $this->baz;\n\
|
|
# }\n# \n# public function otherMethod()\n# {\n# throw new \\RuntimeException('Dummy::otherMethod()\
|
|
\ should not be called');\n# }\n# }\n# \n# class ObjectConstructorArgsWithDefaultValueDummy\n\
|
|
# {\n# protected $foo;\n# protected $bar;\n# \n# public function __construct($foo\
|
|
\ = [], $bar = null)\n# {\n# $this->foo = $foo;\n# $this->bar = $bar;\n# }\n#\
|
|
\ \n# public function getFoo()\n# {\n# return $this->foo;\n# }\n# \n# public function\
|
|
\ getBar()\n# {\n# return $this->bar;\n# }\n# \n# public function otherMethod()\n\
|
|
# {\n# throw new \\RuntimeException('Dummy::otherMethod() should not be called');\n\
|
|
# }\n# }\n# \n# class ObjectWithStaticPropertiesAndMethods\n# {\n# public $foo\
|
|
\ = 'K';\n# public static $bar = 'A';\n# \n# public static function getBaz()\n\
|
|
# {\n# return 'L';\n# }\n# }\n# \n# class ObjectTypeHinted\n# {\n# public function\
|
|
\ setFoo(array $f)\n# {\n# }\n# }\n# \n# class ObjectOuter\n# {\n# public $foo;\n\
|
|
# public $bar;\n# /**\n# * @var ObjectInner"
|
|
- name: date
|
|
visibility: private
|
|
comment: null
|
|
- name: inners
|
|
visibility: private
|
|
comment: '# * @var ObjectInner[]'
|
|
- name: foo
|
|
visibility: public
|
|
comment: null
|
|
- name: bar
|
|
visibility: public
|
|
comment: null
|
|
- name: id
|
|
visibility: private
|
|
comment: null
|
|
- name: inner
|
|
visibility: private
|
|
comment: null
|
|
- name: number
|
|
visibility: public
|
|
comment: '# * @var float'
|
|
- name: foo
|
|
visibility: private
|
|
comment: null
|
|
- name: inner
|
|
visibility: private
|
|
comment: null
|
|
- name: Foo
|
|
visibility: private
|
|
comment: null
|
|
- name: Bar
|
|
visibility: public
|
|
comment: null
|
|
- name: id
|
|
visibility: private
|
|
comment: null
|
|
- name: inner
|
|
visibility: private
|
|
comment: null
|
|
- name: foo
|
|
visibility: public
|
|
comment: null
|
|
- name: ignored
|
|
visibility: public
|
|
comment: null
|
|
- name: private
|
|
visibility: private
|
|
comment: null
|
|
methods:
|
|
- name: setUp
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: createNormalizer
|
|
visibility: private
|
|
parameters:
|
|
- name: defaultContext
|
|
default: '[]'
|
|
- name: classMetadataFactory
|
|
default: 'null'
|
|
comment: null
|
|
- name: testNormalize
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeObjectWithUninitializedProperties
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeObjectWithUnsetProperties
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeObjectWithLazyProperties
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeObjectWithUninitializedPrivateProperties
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeObjectWithPrivatePropertyWithoutGetter
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDenormalize
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDenormalizeEmptyXmlArray
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDenormalizeWithObject
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDenormalizeNull
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testConstructorDenormalize
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testConstructorDenormalizeWithNullArgument
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testConstructorDenormalizeWithMissingOptionalArgument
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testConstructorDenormalizeWithOptionalDefaultArgument
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testConstructorWithObjectDenormalize
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testConstructorWithObjectDenormalizeUsingPropertyInfoExtractor
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testConstructorWithObjectTypeHintDenormalize
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testConstructorWithUnconstructableNullableObjectTypeHintDenormalize
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testConstructorWithUnknownObjectTypeHintDenormalize
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForAttributes
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getDenormalizerForAttributes
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForFilterBool
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: testAttributesContextDenormalizeConstructor
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeSameObjectWithDifferentAttributes
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForCallbacks
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForCallbacksWithPropertyTypeExtractor
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForCircularReference
|
|
visibility: protected
|
|
parameters:
|
|
- name: defaultContext
|
|
comment: null
|
|
- name: getSelfReferencingModel
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: testSiblingReference
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getDenormalizerForConstructArguments
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForGroups
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getDenormalizerForGroups
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: testGroupsNormalizeWithNameConverter
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testGroupsDenormalizeWithNameConverter
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testGroupsDenormalizeWithMetaDataNameConverter
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForIgnoredAttributes
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getDenormalizerForIgnoredAttributes
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForMaxDepth
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getDenormalizerForObjectToPopulate
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForSkipNullValues
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForSkipUninitializedValues
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getObjectCollectionWithExpectedArray
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getNormalizerForCacheableObjectAttributesTest
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: getDenormalizerForTypeEnforcement
|
|
visibility: protected
|
|
parameters: []
|
|
comment: null
|
|
- name: testUnableToNormalizeObjectAttribute
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDenormalizeNonExistingAttribute
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNoTraversableSupport
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeStatic
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeUpperCaseAttributes
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeNotSerializableContext
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testThrowUnexpectedValueException
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDenomalizeRecursive
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testAcceptJsonNumber
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDoesntHaveIssuesWithUnionConstTypes
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testExtractAttributesRespectsContext
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDenormalizeFalsePseudoType
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testAdvancedNameConverter
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: normalize
|
|
visibility: public
|
|
parameters:
|
|
- name: propertyName
|
|
- name: class
|
|
default: 'null'
|
|
- name: format
|
|
default: 'null'
|
|
- name: context
|
|
default: '[]'
|
|
comment: null
|
|
- name: denormalize
|
|
visibility: public
|
|
parameters:
|
|
- name: propertyName
|
|
- name: class
|
|
default: 'null'
|
|
- name: format
|
|
default: 'null'
|
|
- name: context
|
|
default: '[]'
|
|
comment: null
|
|
- name: testDefaultObjectClassResolver
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testObjectClassResolver
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeStdClass
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNotNormalizableValueInvalidType
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeWithoutSerializerSet
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeWithIgnoreAttributeAndPrivateProperties
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDenormalizeWithIgnoreAttributeAndPrivateProperties
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testNormalizeWithPropertyPath
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: testDenormalizeWithPropertyPath
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: foo
|
|
- name: bar
|
|
- name: baz
|
|
comment: null
|
|
- name: getFoo
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: isBaz
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: otherMethod
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: foo
|
|
- name: bar
|
|
default: '[]'
|
|
- name: baz
|
|
default: '[]'
|
|
comment: null
|
|
- name: getFoo
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getBaz
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: otherMethod
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: foo
|
|
default: '[]'
|
|
- name: bar
|
|
default: 'null'
|
|
comment: null
|
|
- name: getFoo
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getBar
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: otherMethod
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getBaz
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: setFoo
|
|
visibility: public
|
|
parameters:
|
|
- name: f
|
|
comment: null
|
|
- name: getInner
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: setInner
|
|
visibility: public
|
|
parameters:
|
|
- name: inner
|
|
comment: null
|
|
- name: setDate
|
|
visibility: public
|
|
parameters:
|
|
- name: date
|
|
comment: null
|
|
- name: getDate
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: setInners
|
|
visibility: public
|
|
parameters:
|
|
- name: inners
|
|
comment: null
|
|
- name: getInners
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: __get
|
|
visibility: public
|
|
parameters:
|
|
- name: name
|
|
comment: null
|
|
- name: __isset
|
|
visibility: public
|
|
parameters:
|
|
- name: name
|
|
comment: null
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: id
|
|
- name: inner
|
|
comment: null
|
|
- name: getId
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getInner
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: id
|
|
- name: unknown
|
|
comment: null
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: foo
|
|
default: '''a'''
|
|
- name: inner
|
|
default: 'null'
|
|
comment: null
|
|
- name: getFoo
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getInner
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getFoo
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: __construct
|
|
visibility: public
|
|
parameters:
|
|
- name: id
|
|
- name: inner
|
|
comment: null
|
|
- name: getId
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
- name: getInner
|
|
visibility: public
|
|
parameters: []
|
|
comment: null
|
|
traits:
|
|
- PHPStan\PhpDocParser\Parser\PhpDocParser
|
|
- PHPUnit\Framework\MockObject\MockObject
|
|
- PHPUnit\Framework\TestCase
|
|
- Symfony\Component\PropertyAccess\Exception\InvalidTypeException
|
|
- Symfony\Component\PropertyInfo\Extractor\PhpDocExtractor
|
|
- Symfony\Component\PropertyInfo\Extractor\PhpStanExtractor
|
|
- Symfony\Component\PropertyInfo\Extractor\ReflectionExtractor
|
|
- Symfony\Component\PropertyInfo\PropertyInfoExtractor
|
|
- Symfony\Component\Serializer\Attribute\Ignore
|
|
- Symfony\Component\Serializer\Exception\LogicException
|
|
- Symfony\Component\Serializer\Exception\NotNormalizableValueException
|
|
- Symfony\Component\Serializer\Exception\RuntimeException
|
|
- Symfony\Component\Serializer\Exception\UnexpectedValueException
|
|
- Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactory
|
|
- Symfony\Component\Serializer\Mapping\Factory\ClassMetadataFactoryInterface
|
|
- Symfony\Component\Serializer\Mapping\Loader\AttributeLoader
|
|
- Symfony\Component\Serializer\Mapping\Loader\YamlFileLoader
|
|
- Symfony\Component\Serializer\NameConverter\AdvancedNameConverterInterface
|
|
- Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter
|
|
- Symfony\Component\Serializer\NameConverter\MetadataAwareNameConverter
|
|
- Symfony\Component\Serializer\Normalizer\AbstractNormalizer
|
|
- Symfony\Component\Serializer\Normalizer\ArrayDenormalizer
|
|
- Symfony\Component\Serializer\Normalizer\DateTimeNormalizer
|
|
- Symfony\Component\Serializer\Normalizer\NormalizerInterface
|
|
- Symfony\Component\Serializer\Normalizer\ObjectNormalizer
|
|
- Symfony\Component\Serializer\Serializer
|
|
- Symfony\Component\Serializer\SerializerInterface
|
|
- Symfony\Component\Serializer\Tests\Fixtures\Attributes\GroupDummy
|
|
- Symfony\Component\Serializer\Tests\Fixtures\CircularReferenceDummy
|
|
- Symfony\Component\Serializer\Tests\Fixtures\DummyPrivatePropertyWithoutGetter
|
|
- Symfony\Component\Serializer\Tests\Fixtures\OtherSerializedNameDummy
|
|
- Symfony\Component\Serializer\Tests\Fixtures\Php74Dummy
|
|
- Symfony\Component\Serializer\Tests\Fixtures\Php74DummyPrivate
|
|
- Symfony\Component\Serializer\Tests\Fixtures\Php80Dummy
|
|
- Symfony\Component\Serializer\Tests\Fixtures\SiblingHolder
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\AttributesTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\CacheableObjectAttributesTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\CallbacksTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\CircularReferenceTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\ConstructorArgumentsTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\ContextMetadataTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\FilterBoolTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\GroupsTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\IgnoredAttributesTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\MaxDepthTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\ObjectDummy
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\ObjectToPopulateTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\SkipNullValuesTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\SkipUninitializedValuesTestTrait
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\TypedPropertiesObject
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\TypedPropertiesObjectWithGetters
|
|
- Symfony\Component\Serializer\Tests\Normalizer\Features\TypeEnforcementTestTrait
|
|
- AttributesTestTrait
|
|
- CacheableObjectAttributesTestTrait
|
|
- CallbacksTestTrait
|
|
- CircularReferenceTestTrait
|
|
- ConstructorArgumentsTestTrait
|
|
- ContextMetadataTestTrait
|
|
- FilterBoolTestTrait
|
|
- GroupsTestTrait
|
|
- IgnoredAttributesTestTrait
|
|
- MaxDepthTestTrait
|
|
- ObjectToPopulateTestTrait
|
|
- SkipNullValuesTestTrait
|
|
- SkipUninitializedValuesTestTrait
|
|
- TypeEnforcementTestTrait
|
|
interfaces:
|
|
- AdvancedNameConverterInterface
|
|
- SerializerInterface
|