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; }); }
/** * @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; }
/** * @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; }