src/Sedona/SBORuntimeBundle/ClassUtils.php
public static function hasTrait($class, $traitName, $isRecursive = false)
    {
        if (is_string($class)) {
            $class = new \ReflectionClass($class);
        }

        if (in_array($traitName, $class->getTraitNames(), true)) {
            return true;
        }

        $parentClass = $class->getParentClass();

        if ((false === $isRecursive) || (false === $parentClass) || (null === $parentClass)) {
            return false;
        }

        return static::hasTrait($parentClass, $traitName, $isRecursive);
    }
public static function hasTrait($class, $traitName, $isRecursive = false)
    {
        if (is_string($class)) {
            $class = new \ReflectionClass($class);
        }

        if (in_array($traitName, $class->getTraitNames(), true)) {
            return true;
        }

        $parentClass = $class->getParentClass();

        if ((false === $isRecursive) || (false === $parentClass) || (null === $parentClass)) {
            return false;
        }

        return static::hasTrait($parentClass, $traitName, $isRecursive);
    }
public static function hasTrait ( $ class , $ traitName , $ isRecursive = false ) { if ( is_string ( $ class ) ) { $ class = new \ ReflectionClass ( $ class ) ; } if ( in_array ( $ traitName , $ class -> getTraitNames ( ) , true ) ) { return true ; } $ parentClass = $ class -> getParentClass ( ) ; if ( ( false === $ isRecursive ) || ( false === $ parentClass ) || ( null === $ parentClass ) ) { return false ; } return static :: hasTrait ( $ parentClass , $ traitName , $ isRecursive ) ; }
Return true if the given object use the given trait, FALSE if not.

@param \ReflectionClass|string $class
@param string                  $traitName
@param bool                    $isRecursive

@return bool
Return true if the given object use the given trait FALSE if not .