列出当前类所有引入的 trait.

laravel class_uses_recursive 输出的顺序并不是引入的顺序，不符合预期

@return array
173996
protected function listTraits()
    {
        $result = [];

        $classes = array_reverse(class_parents(static::class)) + [static::class];
        foreach ($classes as $class) {
            $result += trait_uses_recursive($class);
        }

        return array_unique($result);
    }
653919
public function getUseStatements(): array
    {
        // Check cache.
        if (null === $this->use_statements) {
            $this->use_statements = [];

            // Fetch start of class so we do not
            // include use statements that import traits.
            $tokens = $this->getTokenStream();
            $class  = $this->getClassNameLocation();

            // Find all the use statements and parse them one by one
            // and then add them to the use_statements cache.
            $loc = 0;
            while (($loc = $tokens->scan($loc, [T_USE])) && $loc < $class) {
                [$alias, $use_statement] = $this->parseUse($loc++);
                if ($alias !== null) {
                    $this->use_statements[$alias] = $use_statement;
                } else {
                    $this->use_statements[] = $use_statement;
                }
            }
        }

        return $this->use_statements;
    }
225112
public function mutatorsToArray()
    {
        $mutatedAttributes = [];

        $mutators = $this->getMutatedAttributes();

        foreach ($mutators as $mutator) {
            $mutatedAttributes[Str::snake($mutator)] = $this->mutateAttribute($mutator);
        }

        return $mutatedAttributes;
    }
97930
protected function getAllTraitNames(ReflectionClass $trait)
    {
        $names = [];

        foreach ($trait->getTraits() as $trait) {
            /**
             * @var \ReflectionClass $trait
             */
            $names[] = $trait->getName();

            if ($trait->getTraits()) {
                $names = array_merge($names, $this->getAllTraitNames($trait));
            }
        }

        return $names;
    }
42042
public function getTypes() {
    // If type hint is set then that is the type of the parameter.
    if ($this->typeHint) {
      if ($this->typeHint instanceof TokenNode) {
        if ($this->typeHint->getType() === T_ARRAY) {
          $docTypes = $this->getDocTypes();
          foreach ($docTypes as $docType) {
            if ($docType !== 'array' && substr($docType, -2) !== '[]') {
              return [$this->typeHint->getText()];
            }
          }
          return $docTypes;
        }
        else {
          return [$this->typeHint->getText()];
        }
      }
      else {
        return [$this->typeHint->getAbsolutePath()];
      }
    }
    return $this->getDocTypes();
  }
1315723
public function getRootFieldFacetChoices()
    {
        $roots = [];

        if (!empty($this->fieldFacetChoices)) {
            foreach ($this->fieldFacetChoices as $choice) {
                if (empty($choice->getParent())) {
                    $roots[] = $choice;
                }
            }
        }

        return $roots;
    }
583503
public function getEmbeddableProperties(): array
    {
        if (null !== $this->embeddableProperties) {
            return $this->embeddableProperties;
        }
        $traits = $this->reflectionClass->getTraits();
        $return = [];
        foreach ($traits as $traitName => $traitReflection) {
            if (\ts\stringContains($traitName, '\\Entity\\Embeddable\\Traits')) {
                $property                     = $traitReflection->getProperties()[0]->getName();
                $embeddableObjectInterfaceFqn = $this->getTypesFromVarComment(
                    $property,
                    $this->getReflectionHelper()->getTraitProvidingProperty($traitReflection, $property)
                )[0];
                $embeddableObject             = $this->getNamespaceHelper()
                                                     ->getEmbeddableObjectFqnFromEmbeddableObjectInterfaceFqn(
                                                         $embeddableObjectInterfaceFqn
                                                     );
                $return[$property]            = $embeddableObject;
            }
        }

        return $return;
    }
572809
protected function controllerUsesHelpersTrait()
    {
        if (! $controller = $this->getControllerInstance()) {
            return false;
        }

        $traits = [];

        do {
            $traits = array_merge(class_uses($controller, false), $traits);
        } while ($controller = get_parent_class($controller));

        foreach ($traits as $trait => $same) {
            $traits = array_merge(class_uses($trait, false), $traits);
        }

        return isset($traits[Helpers::class]);
    }
276546
public function getItemTypes()
	{
		$usedTypes = array_reduce( $this->elements, function( $carry, $element ) {
			foreach ( $element as $key => $entry )
			{
				$type = $entry['taxonomy_element']['type'];
				if ( empty( $type ) ) continue;

				if ( ! isset( $carry[ $type ] ) )
				{
					$carry[ $type ] = 1;
				}
			}

			return $carry;
		}, array() );

		return array_keys( $usedTypes );
	}
729600
function &traits()
    {
        $traits = NULL;
        foreach ($this->_classes as $name => $trait) {
            if ($trait->isTrait()) {
                $traits[$name] =& $this->_classes[$name];
            }
        }

        return $traits;
    }
227064
public function getMethods()
    {
        $behaviors = $this->getRepository()->getBehaviors();

        foreach ($behaviors as $behavior) {
            $this->mixin($behavior);
        }

        return parent::getMethods();
    }
1019070
public function getUseLines()
    {
        $lines = [];

        $lines = array_merge($lines, $this->getUseLinesSymfony2Part());

        $lines[] = 'use Doctrine\ORM\Mapping as ORM;';

        $useArrayCollection = false;

        foreach ($this->getEntity()->getAttributes() as $attr) {
            if (null !== $attr->getForeign() && 'array' === $attr->getType()) {
                $useArrayCollection = true;
                break;
            }
        }

        if ($useArrayCollection) {
            $lines[] = 'use Doctrine\\Common\\Collections\\ArrayCollection;';
        }


        $lines = array_merge($lines, $this->getUseLinesUserAdditionsPart());

        return $lines;
    }
601324
public function &getChildren($recursive = false)
	{
		if (!$this->_allChildrenloaded)
		{
			$temp = $this->_constructor->get($this->id, true);

			if ($temp)
			{
				$this->_children = $temp->getChildren();
				$this->_leftSibling = $temp->getSibling(false);
				$this->_rightSibling = $temp->getSibling(true);
				$this->setAllLoaded();
			}
		}

		if ($recursive)
		{
			$items = array();

			foreach ($this->_children as $child)
			{
				$items[] = $child;
				$items = array_merge($items, $child->getChildren(true));
			}

			return $items;
		}

		return $this->_children;
	}
355090
public function getVariables()
    {
        if (!$this->getUseIndex()) {
            return array();
        }

        $staticVariables = $this->reflection->getStaticVariables();

        // When looping through the variables, we will only take the variables that are
        // specified in the use clause, and will not take any other static variables
        // that may be used by the Closures, allowing this to re-create its state.
        $usedVariables = array();

        foreach ($this->getUseClauseVariables() as $variable) {
            $variable = trim($variable, ' $&');

            $usedVariables[$variable] = $staticVariables[$variable];
        }

        return $usedVariables;
    }
600572
public function getTraits() {
    	if (version_compare(PHP_VERSION, "5.4.0", '<')) {
    		// I'm not using PHP 5.4 or higher
    		return array();
    	}
    	
    	if ($this->traits !== null) {
    		return $this->traits;
    	}
    	
    	$traitNames = parent::getTraitNames();
    	$this->traits = array_map(function($name) { return new MoufReflectionClass($name); }, $traitNames);
    	
    	return $this->traits;
    }
1299624
public function getMethods()
    {
        //todo cache
        $result = array();
        foreach ($this->getReflectionClass()->getMethods() as $m)
        {
            $result[] = MethodInfo::__internal_create($this, $m);
        }
        return $result;
    }
425210
public function toArray()
    {
        // First, call the trait method before filtering
        // with Entity specific methods
        $attributes = $this->attributesToArray($this->attributes);

        foreach ($this->attributes as $key => $attribute) {
            if (in_array($key, $this->hidden)) {
                unset($attributes[$key]);
                continue;
            }
            if ($this->hasGetMutator($key)) {
                $method = 'get'.$this->getMutatorMethod($key);
                $attributes[$key] = $this->$method($attribute);
            }
        }

        return $attributes;
    }