src/Analyse/Comment/Methods.php
protected function getTraitComment($originalComment, \ReflectionClass $reflection)
    {
        // We need to check if we can get traits here.
        if (method_exists($reflection, 'getTraits') === true) {
            // Get the traits from this class.
            // Now we should have an array with reflections of all
            // traits in the class we are currently looking at.
            foreach ($reflection->getTraits() as $trait) {
                if ($this->checkComment($originalComment) === true) {
                    // Looks like we've resolved them all.
                    return $originalComment;
                }

                // We need to look further!
                if ($trait->hasMethod($this->methodName) === true) {
                    $traitComment = $this->prettifyComment(
                        $trait->getMethod($this->methodName)->getDocComment()
                    );
                    // Replace it.
                    $originalComment = $this->replaceInheritComment($originalComment, $traitComment);
                }
            }

            // Return what we could resolve so far.
            return $originalComment;
        }

        // Wrong PHP version. Traits are not available.
        return $originalComment;
    }
protected function getTraitComment($originalComment, \ReflectionClass $reflection)
    {
        // We need to check if we can get traits here.
        if (method_exists($reflection, 'getTraits') === true) {
            // Get the traits from this class.
            // Now we should have an array with reflections of all
            // traits in the class we are currently looking at.
            foreach ($reflection->getTraits() as $trait) {
                if ($this->checkComment($originalComment) === true) {
                    // Looks like we've resolved them all.
                    return $originalComment;
                }

                // We need to look further!
                if ($trait->hasMethod($this->methodName) === true) {
                    $traitComment = $this->prettifyComment(
                        $trait->getMethod($this->methodName)->getDocComment()
                    );
                    // Replace it.
                    $originalComment = $this->replaceInheritComment($originalComment, $traitComment);
                }
            }

            // Return what we could resolve so far.
            return $originalComment;
        }

        // Wrong PHP version. Traits are not available.
        return $originalComment;
    }
protected function getTraitComment ( $ originalComment , \ ReflectionClass $ reflection ) { // We need to check if we can get traits here. if ( method_exists ( $ reflection , 'getTraits' ) === true ) { // Get the traits from this class. // Now we should have an array with reflections of all // traits in the class we are currently looking at. foreach ( $ reflection -> getTraits ( ) as $ trait ) { if ( $ this -> checkComment ( $ originalComment ) === true ) { // Looks like we've resolved them all. return $ originalComment ; } // We need to look further! if ( $ trait -> hasMethod ( $ this -> methodName ) === true ) { $ traitComment = $ this -> prettifyComment ( $ trait -> getMethod ( $ this -> methodName ) -> getDocComment ( ) ) ; // Replace it. $ originalComment = $ this -> replaceInheritComment ( $ originalComment , $ traitComment ) ; } } // Return what we could resolve so far. return $ originalComment ; } // Wrong PHP version. Traits are not available. return $ originalComment ; }
Gets the comment from all added traits.

Iterated through an array of traits, to see
if we can resolve the inherited comment. Traits
are only supported since PHP 5.4, so we need to
check if they are available.

@param string $originalComment
The original comment, so far.
@param \ReflectionClass $reflection
A reflection of the object we are currently analysing.

@return string
The comment from one of the trait.
Gets the comment from all added traits .