public function getDescription($docComment): string
    {
        $docComment  = (string) $docComment;
        $description = [];

        // split at each line
        foreach (preg_split(self::REGEX_SPLIT_BY_NEWLINE, $docComment) as $line) {
            // if line does not start with asterisk, or only contains an asterisk, do nothing
            if (!preg_match(self::REGEX_LINE_HAS_CONTENT, $line, $matches)) {
                continue;
            }

            // trim whitespace and remove leading asterisk
            $info = trim(preg_replace(self::REGEX_REMOVE_LEADING_ASTERISK, '', trim($matches[1])));

            // add to description if info not start with a tag marked for skipping (annotation, phpDoc tag)
            $addInfo = true;

            foreach (self::DESCRIPTION_SKIP_TAGS as $skipTag) {
                if (substr($info, 0, strlen($skipTag)) === $skipTag) {
                    $addInfo = false;
                }
            }

            if ($addInfo) {
                $description[] = $info;
            }
        }

        return implode("\n", $description);
    }
public function getDescription($docComment): string
    {
        $docComment  = (string) $docComment;
        $description = [];

        // split at each line
        foreach (preg_split(self::REGEX_SPLIT_BY_NEWLINE, $docComment) as $line) {
            // if line does not start with asterisk, or only contains an asterisk, do nothing
            if (!preg_match(self::REGEX_LINE_HAS_CONTENT, $line, $matches)) {
                continue;
            }

            // trim whitespace and remove leading asterisk
            $info = trim(preg_replace(self::REGEX_REMOVE_LEADING_ASTERISK, '', trim($matches[1])));

            // add to description if info not start with a tag marked for skipping (annotation, phpDoc tag)
            $addInfo = true;

            foreach (self::DESCRIPTION_SKIP_TAGS as $skipTag) {
                if (substr($info, 0, strlen($skipTag)) === $skipTag) {
                    $addInfo = false;
                }
            }

            if ($addInfo) {
                $description[] = $info;
            }
        }

        return implode("\n", $description);
    }
public function getDescription ( $ docComment ) : string { $ docComment = ( string ) $ docComment ; $ description = [ ] ; // split at each line foreach ( preg_split ( self :: REGEX_SPLIT_BY_NEWLINE , $ docComment ) as $ line ) { // if line does not start with asterisk, or only contains an asterisk, do nothing if ( ! preg_match ( self :: REGEX_LINE_HAS_CONTENT , $ line , $ matches ) ) { continue ; } // trim whitespace and remove leading asterisk $ info = trim ( preg_replace ( self :: REGEX_REMOVE_LEADING_ASTERISK , '' , trim ( $ matches [ 1 ] ) ) ) ; // add to description if info not start with a tag marked for skipping (annotation, phpDoc tag) $ addInfo = true ; foreach ( self :: DESCRIPTION_SKIP_TAGS as $ skipTag ) { if ( substr ( $ info , 0 , strlen ( $ skipTag ) ) === $ skipTag ) { $ addInfo = false ; } } if ( $ addInfo ) { $ description [ ] = $ info ; } } return implode ( "\n" , $ description ) ; }
Get the description from a doc comment; new lines are split by "\n".

@param string $docComment cannot type-hint, if empty getDocComment() returns false even though it says string
@return string
Get the description from a doc comment ; new lines are split by \ n .