protected function createSimpleProperty($data, PropertyInterface $property) { $reference = $property->getReference(); if (!empty($reference)) { try { $class = new ReflectionClass($reference); $constructor = $class->getConstructor(); if ($constructor instanceof ReflectionMethod && $constructor->getNumberOfRequiredParameters() == 1) { return $class->newInstance($data); } } catch (ReflectionException $e) { // class does not exist } } return $data; }