BetterReflection\Reflection\ReflectionClass::isTrait PHP Method

isTrait() public method

Is this reflection a trait?
public isTrait ( ) : boolean
return boolean
    public function isTrait()
    {
        return $this->node instanceof TraitNode;
    }

Usage Example

 /**
  * @param ReflectionClass $class
  *
  * @return self
  */
 public static function fromReflectionClass(ReflectionClass $class)
 {
     $type = 'class';
     if ($class->isTrait()) {
         $type = 'trait';
     }
     return new self(sprintf('Provided node "%s" is not interface, but "%s"', $class->getName(), $type));
 }
All Usage Examples Of BetterReflection\Reflection\ReflectionClass::isTrait