src/AnnotationParser.php
public function parse($commentString, $target)
    {
        // Extract the description part of the comment block
        $commentString = $this->stripCommentDecoration($commentString);
        $parts         = preg_split('/^\s*(?=@[a-zA-Z]+)/m', $commentString, 2);

        $comment = new Comment(trim($parts[0]));

        if (!isset($parts[1])) {
            return $comment;
        }
        $trimmed = trim($parts[1]);
        if (empty($trimmed)) {
            return $comment;
        }

        $pattern        = '/(\'(?:\\\\.|[^\'\\\\])*\'|"(?:\\\\.|[^"\\\\])*"|[@(),={}]|\s+|(?<![:])[:](?![:]))/';
        $flags          = PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY;
        $this->parts    = preg_split($pattern, $parts[1], -1, $flags);
        $this->position = -1;

        while (isset($this->parts[ ++$this->position ])) {
            if ($this->parts[ $this->position ] === '@') {
                list($name, $parameters, $isClass) = $this->parseTag();
                if ($isClass) {
                    $className = $this->getFullyQualifiedName($name);

                    $this->saveState();
                    $comment->addAnnotation(
                        $className,
                        $this->container->readClass($className, $parameters, $target)
                    );
                    $this->restoreState();
                } else {
                    $comment->add($name, $parameters);
                }
            }
        }

        return $comment;
    }
public function parse($commentString, $target)
    {
        // Extract the description part of the comment block
        $commentString = $this->stripCommentDecoration($commentString);
        $parts         = preg_split('/^\s*(?=@[a-zA-Z]+)/m', $commentString, 2);

        $comment = new Comment(trim($parts[0]));

        if (!isset($parts[1])) {
            return $comment;
        }
        $trimmed = trim($parts[1]);
        if (empty($trimmed)) {
            return $comment;
        }

        $pattern        = '/(\'(?:\\\\.|[^\'\\\\])*\'|"(?:\\\\.|[^"\\\\])*"|[@(),={}]|\s+|(?<![:])[:](?![:]))/';
        $flags          = PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY;
        $this->parts    = preg_split($pattern, $parts[1], -1, $flags);
        $this->position = -1;

        while (isset($this->parts[ ++$this->position ])) {
            if ($this->parts[ $this->position ] === '@') {
                list($name, $parameters, $isClass) = $this->parseTag();
                if ($isClass) {
                    $className = $this->getFullyQualifiedName($name);

                    $this->saveState();
                    $comment->addAnnotation(
                        $className,
                        $this->container->readClass($className, $parameters, $target)
                    );
                    $this->restoreState();
                } else {
                    $comment->add($name, $parameters);
                }
            }
        }

        return $comment;
    }
public function parse ( $ commentString , $ target ) { // Extract the description part of the comment block $ commentString = $ this -> stripCommentDecoration ( $ commentString ) ; $ parts = preg_split ( '/^\s*(?=@[a-zA-Z]+)/m' , $ commentString , 2 ) ; $ comment = new Comment ( trim ( $ parts [ 0 ] ) ) ; if ( ! isset ( $ parts [ 1 ] ) ) { return $ comment ; } $ trimmed = trim ( $ parts [ 1 ] ) ; if ( empty ( $ trimmed ) ) { return $ comment ; } $ pattern = '/(\'(?:\\\\.|[^\'\\\\])*\'|"(?:\\\\.|[^"\\\\])*"|[@(),={}]|\s+|(?<![:])[:](?![:]))/' ; $ flags = PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY ; $ this -> parts = preg_split ( $ pattern , $ parts [ 1 ] , - 1 , $ flags ) ; $ this -> position = - 1 ; while ( isset ( $ this -> parts [ ++ $ this -> position ] ) ) { if ( $ this -> parts [ $ this -> position ] === '@' ) { list ( $ name , $ parameters , $ isClass ) = $ this -> parseTag ( ) ; if ( $ isClass ) { $ className = $ this -> getFullyQualifiedName ( $ name ) ; $ this -> saveState ( ) ; $ comment -> addAnnotation ( $ className , $ this -> container -> readClass ( $ className , $ parameters , $ target ) ) ; $ this -> restoreState ( ) ; } else { $ comment -> add ( $ name , $ parameters ) ; } } } return $ comment ; }
Parses a documentation comment.

@param string $commentString
@param        $target

@return Comment
Parses a documentation comment .