use Symfony\Component\Serializer\Normalizer\AbstractNormalizer;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
use Symfony\Component\Serializer\Tests\Fixtures\AbstractNormalizerDummy;
+use Symfony\Component\Serializer\Tests\Fixtures\NullableConstructorArgumentDummy;
use Symfony\Component\Serializer\Tests\Fixtures\ProxyDummy;
use Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorDummy;
use Symfony\Component\Serializer\Tests\Fixtures\StaticConstructorNormalizer;
$this->assertEquals('baz', $dummy->quz);
$this->assertNull($dummy->foo);
}
+
+ /**
+ * @requires PHP 7.1
+ */
+ public function testObjectWithNullableConstructorArgument()
+ {
+ $normalizer = new ObjectNormalizer();
+ $dummy = $normalizer->denormalize(array('foo' => null), NullableConstructorArgumentDummy::class);
+
+ $this->assertNull($dummy->getFoo());
+ }
}