Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DocParser.php

function DocParser::parse

Same name in this branch
  1. 11.1.x core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::parse()

Parses the given docblock string for annotations.

@phpstan-return list<object> Array of annotations. If no annotations are found, an empty array is returned.

Throws

AnnotationException

ReflectionException

File

vendor/doctrine/annotations/lib/Doctrine/Common/Annotations/DocParser.php, line 358

Class

DocParser
A parser for docblock annotations.

Namespace

Doctrine\Common\Annotations

Code

public function parse(string $input, string $context = '') {
    $pos = $this->findInitialTokenPosition($input);
    if ($pos === null) {
        return [];
    }
    $this->context = $context;
    $this->lexer
        ->setInput(trim(substr($input, $pos), '* /'));
    $this->lexer
        ->moveNext();
    return $this->Annotations();
}
RSS feed
Powered by Drupal