+
+class DummyCollection
+{
+ /** @var DummyChild[] */
+ public $children;
+}
+
+class DummyChild
+{
+ public $bar;
+}
+
+class SerializerCollectionDummy implements SerializerInterface, DenormalizerInterface
+{
+ private $normalizers;
+
+ /**
+ * @param DenormalizerInterface[] $normalizers
+ */
+ public function __construct($normalizers)
+ {
+ $this->normalizers = $normalizers;
+ }
+
+ public function serialize($data, $format, array $context = array())
+ {
+ }
+
+ public function deserialize($data, $type, $format, array $context = array())
+ {
+ }
+
+ public function denormalize($data, $type, $format = null, array $context = array())
+ {
+ foreach ($this->normalizers as $normalizer) {
+ if ($normalizer instanceof DenormalizerInterface && $normalizer->supportsDenormalization($data, $type, $format, $context)) {
+ return $normalizer->denormalize($data, $type, $format, $context);
+ }
+ }
+ }
+
+ public function supportsDenormalization($data, $type, $format = null)
+ {
+ return true;
+ }
+}
+
+class AbstractObjectNormalizerCollectionDummy extends AbstractObjectNormalizer
+{
+ protected function extractAttributes($object, $format = null, array $context = array())
+ {
+ }
+
+ protected function getAttributeValue($object, $attribute, $format = null, array $context = array())
+ {
+ }
+
+ protected function setAttributeValue($object, $attribute, $value, $format = null, array $context = array())
+ {
+ $object->$attribute = $value;
+ }
+
+ protected function isAllowedAttribute($classOrObject, $attribute, $format = null, array $context = array())
+ {
+ return true;
+ }
+
+ public function instantiateObject(array &$data, $class, array &$context, \ReflectionClass $reflectionClass, $allowedAttributes, $format = null)
+ {
+ return parent::instantiateObject($data, $class, $context, $reflectionClass, $allowedAttributes, $format);
+ }
+
+ public function serialize($data, $format, array $context = array())
+ {
+ }
+
+ public function deserialize($data, $type, $format, array $context = array())
+ {
+ }
+}
+
+class ArrayDenormalizerDummy implements DenormalizerInterface, SerializerAwareInterface
+{
+ /**
+ * @var SerializerInterface|DenormalizerInterface
+ */
+ private $serializer;
+
+ /**
+ * {@inheritdoc}
+ *
+ * @throws NotNormalizableValueException
+ */
+ public function denormalize($data, $class, $format = null, array $context = array())
+ {
+ $serializer = $this->serializer;
+ $class = substr($class, 0, -2);
+
+ foreach ($data as $key => $value) {
+ $data[$key] = $serializer->denormalize($value, $class, $format, $context);
+ }
+
+ return $data;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsDenormalization($data, $type, $format = null, array $context = array())
+ {
+ return '[]' === substr($type, -2)
+ && $this->serializer->supportsDenormalization($data, substr($type, 0, -2), $format, $context);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function setSerializer(SerializerInterface $serializer)
+ {
+ $this->serializer = $serializer;
+ }
+}