Ejemplo n.º 1
0
 protected function resolveDocTagType(Type $type)
 {
     return $type->walk(function (Type $type) {
         if ($type instanceof ObjectType) {
             $nameStr = $type->getClass();
             if ($nameStr !== null && $nameStr !== '') {
                 if ($nameStr[0] === '\\') {
                     $name = new FullyQualified(substr($nameStr, 1));
                 } else {
                     $name = new Name($nameStr);
                 }
                 $name = $this->resolveClassName($name)->getAttribute('resolved');
                 $nameStr = $name->toString();
                 if ($name instanceof FullyQualified) {
                     $nameStr = '\\' . $nameStr;
                 }
                 return Type::object_($nameStr);
             }
         }
         return $type;
     });
 }
Ejemplo n.º 2
0
 /**
  * @param Type   $objectType
  * @param string $propertyName
  * @param bool   $staticContext
  *
  * @return Property[]
  */
 protected function findProperties(Type $objectType, $propertyName, $staticContext = false)
 {
     $properties = [];
     if ($objectType instanceof AlternativesType) {
         foreach ($objectType->getAlternatives() as $altType) {
             $properties = array_merge($properties, $this->findProperties($altType, $propertyName, $staticContext));
         }
     } elseif ($objectType instanceof ObjectType) {
         $property = $this->reflection->findProperty($objectType->getClass(), $propertyName);
         if ($property !== null && $staticContext === $property->isStatic()) {
             $properties[] = $property;
         }
     }
     return $properties;
 }
Ejemplo n.º 3
0
 /**
  * @param Type $objectType
  *
  * @return ClassConst[]
  */
 protected function findClassConsts(Type $objectType)
 {
     $consts = [];
     if ($objectType instanceof AlternativesType) {
         foreach ($objectType->getAlternatives() as $altType) {
             $consts = array_merge($consts, $this->findClassConsts($altType));
         }
     } elseif ($objectType instanceof ObjectType) {
         foreach ($this->reflection->findAllClassConsts($objectType->getClass()) as $const) {
             $consts[] = $const;
         }
     }
     return $consts;
 }