src/ReflectionClass.php
public static function collectTraitsFromClassNode(ClassLike $classLikeNode, array &$traitAdaptations)
    {
        $traits = [];

        if (!empty($classLikeNode->stmts)) {
            foreach ($classLikeNode->stmts as $classLevelNode) {
                if ($classLevelNode instanceof TraitUse) {
                    foreach ($classLevelNode->traits as $classTraitName) {
                        if ($classTraitName instanceof FullyQualified) {
                            $traitName          = $classTraitName->toString();
                            $trait              = trait_exists($traitName, false)
                                ? new parent($traitName)
                                : new static($traitName);
                            $traits[$traitName] = $trait;
                        }
                    }
                    $traitAdaptations = $classLevelNode->adaptations;
                }
            }
        }

        return $traits;
    }
public static function collectTraitsFromClassNode(ClassLike $classLikeNode, array &$traitAdaptations)
    {
        $traits = [];

        if (!empty($classLikeNode->stmts)) {
            foreach ($classLikeNode->stmts as $classLevelNode) {
                if ($classLevelNode instanceof TraitUse) {
                    foreach ($classLevelNode->traits as $classTraitName) {
                        if ($classTraitName instanceof FullyQualified) {
                            $traitName          = $classTraitName->toString();
                            $trait              = trait_exists($traitName, false)
                                ? new parent($traitName)
                                : new static($traitName);
                            $traits[$traitName] = $trait;
                        }
                    }
                    $traitAdaptations = $classLevelNode->adaptations;
                }
            }
        }

        return $traits;
    }
public static function collectTraitsFromClassNode ( ClassLike $ classLikeNode , array & $ traitAdaptations ) { $ traits = [ ] ; if ( ! empty ( $ classLikeNode -> stmts ) ) { foreach ( $ classLikeNode -> stmts as $ classLevelNode ) { if ( $ classLevelNode instanceof TraitUse ) { foreach ( $ classLevelNode -> traits as $ classTraitName ) { if ( $ classTraitName instanceof FullyQualified ) { $ traitName = $ classTraitName -> toString ( ) ; $ trait = trait_exists ( $ traitName , false ) ? new parent ( $ traitName ) : new static ( $ traitName ) ; $ traits [ $ traitName ] = $ trait ; } } $ traitAdaptations = $ classLevelNode -> adaptations ; } } } return $ traits ; }
Parses traits from the concrete class node

@param ClassLike $classLikeNode Class-like node
@param array     $traitAdaptations List of method adaptations

@return array|\ReflectionClass[] List of reflections of traits
Parses traits from the concrete class node