/**
  * (@inheritdoc)
  */
 public function deserialize($type, array $data)
 {
     if ($data instanceof \ArrayObject) {
         $data = $data->getArrayCopy();
     }
     if (is_object($type)) {
         $type = get_class($type);
     }
     if ($this->handler->canDeserialize($type)) {
         return $this->handler->deserialize($type, $data);
     }
     $reflectionClass = new \ReflectionClass($type);
     $object = $reflectionClass->newInstanceWithoutConstructor();
     $object = $this->setReflectionPropertiesFromData($data, $reflectionClass, $object);
     return $object;
 }
 /**
  * @dataProvider provideRoundTripData
  */
 public function testRoundTrip($input)
 {
     $reflectionSerializer = new ReflectionPropertiesSerializer();
     $data = $reflectionSerializer->serialize($input);
     // Let's simulate converting this to a JSON string and
     // back again.
     $data = json_decode(json_encode($data), true);
     $object = $reflectionSerializer->deserialize($input, $data);
     $this->assertEquals($input, $object);
 }
 private function subDeserialize($type, $data)
 {
     if ($data instanceof \ArrayObject) {
         $data = $data->getArrayCopy();
     }
     if ($this->handler->canDeserialize($type, $data)) {
         return $this->handler->deserialize($type, $data);
     }
     return $this->deserialize($type, $data);
 }