src/Analyser.php
public function fromComment($comment, $context = null)
    {
        if ($context === null) {
            $context = new Context(['comment' => $comment]);
        } else {
            $context->comment = $comment;
        }
        try {
            self::$context = $context;
            if ($context->is('annotations') === false) {
                $context->annotations = [];
            }
            $comment = preg_replace_callback(
                '/^[\t ]*\*[\t ]+/m',
                function ($match) {
                    // Replace leading tabs with spaces.
                    // Workaround for http://www.doctrine-project.org/jira/browse/DCOM-255
                    return str_replace("\t", ' ', $match[0]);
                },
                $comment
            );
            $annotations = $this->docParser->parse($comment, $context);
            self::$context = null;
            return $annotations;
        } catch (Exception $e) {
            self::$context = null;
            if (preg_match('/^(.+) at position ([0-9]+) in ' . preg_quote((string)$context, '/') . '\.$/', $e->getMessage(), $matches)) {
                $errorMessage = $matches[1];
                $errorPos = (int)$matches[2];
                $atPos = strpos($comment, '@');
                $context->line += substr_count($comment, "\n", 0, $atPos + $errorPos);
                $lines = explode("\n", substr($comment, $atPos, $errorPos));
                $context->character = strlen(array_pop($lines)) + 1; // position starts at 0 character starts at 1
                Logger::warning(new Exception($errorMessage . ' in ' . $context, $e->getCode(), $e));
            } else {
                Logger::warning($e);
            }
            return [];
        }
    }
public function fromComment($comment, $context = null)
    {
        if ($context === null) {
            $context = new Context(['comment' => $comment]);
        } else {
            $context->comment = $comment;
        }
        try {
            self::$context = $context;
            if ($context->is('annotations') === false) {
                $context->annotations = [];
            }
            $comment = preg_replace_callback(
                '/^[\t ]*\*[\t ]+/m',
                function ($match) {
                    // Replace leading tabs with spaces.
                    // Workaround for http://www.doctrine-project.org/jira/browse/DCOM-255
                    return str_replace("\t", ' ', $match[0]);
                },
                $comment
            );
            $annotations = $this->docParser->parse($comment, $context);
            self::$context = null;
            return $annotations;
        } catch (Exception $e) {
            self::$context = null;
            if (preg_match('/^(.+) at position ([0-9]+) in ' . preg_quote((string)$context, '/') . '\.$/', $e->getMessage(), $matches)) {
                $errorMessage = $matches[1];
                $errorPos = (int)$matches[2];
                $atPos = strpos($comment, '@');
                $context->line += substr_count($comment, "\n", 0, $atPos + $errorPos);
                $lines = explode("\n", substr($comment, $atPos, $errorPos));
                $context->character = strlen(array_pop($lines)) + 1; // position starts at 0 character starts at 1
                Logger::warning(new Exception($errorMessage . ' in ' . $context, $e->getCode(), $e));
            } else {
                Logger::warning($e);
            }
            return [];
        }
    }
public function fromComment ( $ comment , $ context = null ) { if ( $ context === null ) { $ context = new Context ( [ 'comment' => $ comment ] ) ; } else { $ context -> comment = $ comment ; } try { self :: $ context = $ context ; if ( $ context -> is ( 'annotations' ) === false ) { $ context -> annotations = [ ] ; } $ comment = preg_replace_callback ( '/^[\t ]*\*[\t ]+/m' , function ( $ match ) { // Replace leading tabs with spaces. // Workaround for http://www.doctrine-project.org/jira/browse/DCOM-255 return str_replace ( "\t" , ' ' , $ match [ 0 ] ) ; } , $ comment ) ; $ annotations = $ this -> docParser -> parse ( $ comment , $ context ) ; self :: $ context = null ; return $ annotations ; } catch ( Exception $ e ) { self :: $ context = null ; if ( preg_match ( '/^(.+) at position ([0-9]+) in ' . preg_quote ( ( string ) $ context , '/' ) . '\.$/' , $ e -> getMessage ( ) , $ matches ) ) { $ errorMessage = $ matches [ 1 ] ; $ errorPos = ( int ) $ matches [ 2 ] ; $ atPos = strpos ( $ comment , '@' ) ; $ context -> line += substr_count ( $ comment , "\n" , 0 , $ atPos + $ errorPos ) ; $ lines = explode ( "\n" , substr ( $ comment , $ atPos , $ errorPos ) ) ; $ context -> character = strlen ( array_pop ( $ lines ) ) + 1 ; // position starts at 0 character starts at 1 Logger :: warning ( new Exception ( $ errorMessage . ' in ' . $ context , $ e -> getCode ( ) , $ e ) ) ; } else { Logger :: warning ( $ e ) ; } return [ ] ; } }
Use doctrine to parse the comment block and return the detected annotations.

@param  string  $comment a T_DOC_COMMENT.
@param  Context $context
@return array Annotations
Use doctrine to parse the comment block and return the detected annotations .