BetterReflection\Reflection\ReflectionParameter::getClass PHP Метод

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

Gets a ReflectionClass for the type hint (returns null if not a class)
public getClass ( ) : ReflectionClass | null
Результат ReflectionClass | null
    public function getClass()
    {
        $hint = $this->getTypeHint();
        if (!$hint instanceof Types\Object_) {
            return null;
        }
        if (!$this->reflector instanceof ClassReflector) {
            throw new \RuntimeException('Unable to reflect class type because we were not given a ClassReflector');
        }
        return $this->reflector->reflect($hint->getFqsen()->__toString());
    }

Usage Example

 /**
  * {@inheritDoc}
  */
 public function getClass()
 {
     $class = $this->betterReflectionParameter->getClass();
     if (null === $class) {
         return null;
     }
     return new ReflectionClass($class);
 }
All Usage Examples Of BetterReflection\Reflection\ReflectionParameter::getClass