/**
  * @param string $info
  *
  * @return Type|null
  */
 public function parseSimpleTypes($info)
 {
     $type = new Type();
     if (isset(static::$types[$info])) {
         $type->setType(static::$types[$info]);
         $type->setCollection('array' === $info);
         return $type;
     }
     if (class_exists($info, true)) {
         $class = new \ReflectionClass($info);
         $collection = $class->implementsInterface('HH\\Collection');
         $type->setType('object');
         $type->setClass($info);
         $type->setCollection($collection);
         return $type;
     }
 }
 /**
  * @param string $info
  *
  * @return array|Type[]|null
  */
 public function parse($info)
 {
     $type = new Type();
     if ('double' === $info) {
         $type->setType('float');
         return [$type];
     }
     if ('array' === $info) {
         $type->setType('array');
         $type->setCollection(true);
         return [$type];
     }
     if (class_exists($info)) {
         $type->setType('object');
         $type->setClass($info);
         $type->setCollection(true);
         return [$type];
     }
     if (null !== $info) {
         $type->setType($info);
         return [$type];
     }
 }
 public function extractTypes(\ReflectionProperty $reflectionProperty)
 {
     $className = $reflectionProperty->getDeclaringClass()->getName();
     try {
         $metadata = $this->classMetadataFactory->getMetadataFor($className);
     } catch (MappingException $exception) {
         return;
     }
     $type = new Type();
     $propertyName = $reflectionProperty->getName();
     if ($metadata->hasAssociation($propertyName)) {
         $class = $metadata->getAssociationTargetClass($propertyName);
         if ($metadata->isSingleValuedAssociation($propertyName)) {
             $type->setCollection(false);
             $type->setType('object');
             $type->setClass($class);
         } else {
             $type->setCollection(true);
             $type->setType('object');
             $type->setClass('Doctrine\\Common\\Collections\\Collection');
             $collectionType = new Type();
             $collectionType->setCollection(false);
             $collectionType->setType('object');
             $collectionType->setClass($class);
             $type->setCollectionType($collectionType);
         }
         return [$type];
     }
     if ($metadata->hasField($propertyName)) {
         $typeOfField = $metadata->getTypeOfField($propertyName);
         switch ($typeOfField) {
             case 'date':
                 // No break
             // No break
             case 'datetime':
                 // No break
             // No break
             case 'datetimetz':
                 // No break
             // No break
             case 'time':
                 $type->setType('object');
                 $type->setClass('DateTime');
                 $type->setCollection(false);
                 return [$type];
             case 'array':
                 // No break
             // No break
             case 'simple_array':
                 // No break
             // No break
             case 'json_array':
                 $type->setType('array');
                 $type->setCollection(true);
                 return [$type];
             default:
                 $type->setType($this->getPhpType($typeOfField));
                 $type->setCollection(false);
                 return [$type];
         }
     }
 }
 /**
  * Creates a {@see Type} from a PHPDoc type.
  *
  * @param string $docType
  *
  * @return Type|null
  */
 private function createType($docType)
 {
     // Cannot guess
     if (!$docType || 'mixed' === $docType) {
         return;
     }
     if ($collection = '[]' === substr($docType, -2)) {
         $docType = substr($docType, 0, -2);
     }
     $array = 'array' === $docType;
     $type = new Type();
     if ($collection || $array) {
         $type->setCollection(true);
         $type->setType('array');
         if (!$array && 'mixed' !== $docType) {
             $docType = $this->normalizeType($docType);
             $collectionType = new Type();
             $collectionType->setCollection(false);
             $this->populateType($collectionType, $docType);
             $type->setCollectionType($collectionType);
         }
         return $type;
     }
     $docType = $this->normalizeType($docType);
     $type->setCollection(false);
     $this->populateType($type, $docType);
     return $type;
 }