BetterReflection\Reflection\ReflectionProperty::getDeclaringClass PHP Метод

getDeclaringClass() публичный Метод

public getDeclaringClass ( ) : ReflectionClass
Результат ReflectionClass
    public function getDeclaringClass()
    {
        return $this->declaringClass;
    }

Usage Example

Пример #1
0
 /**
  * Given a property, attempt to find the type of the property.
  *
  * @param ReflectionProperty $reflectionProperty
  * @return Type[]
  */
 public function __invoke(ReflectionProperty $reflectionProperty)
 {
     $contextFactory = new ContextFactory();
     $context = $contextFactory->createForNamespace($reflectionProperty->getDeclaringClass()->getNamespaceName(), $reflectionProperty->getDeclaringClass()->getLocatedSource()->getSource());
     $docBlock = DocBlockFactory::createInstance()->create($reflectionProperty->getDocComment(), new Context($context->getNamespace(), $context->getNamespaceAliases()));
     /* @var \phpDocumentor\Reflection\DocBlock\Tags\Var_ $varTag */
     $resolvedTypes = [];
     $varTags = $docBlock->getTagsByName('var');
     foreach ($varTags as $varTag) {
         $resolvedTypes = array_merge($resolvedTypes, (new ResolveTypes())->__invoke(explode('|', $varTag->getType()), $context));
     }
     return $resolvedTypes;
 }
All Usage Examples Of BetterReflection\Reflection\ReflectionProperty::getDeclaringClass