function DocParser::Annotations
Same name in this branch
- 11.1.x core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::Annotations()
Annotations ::= Annotation {[ "*" ]* [Annotation]}*
@phpstan-return list<object>
Throws
ReflectionException
1 call to DocParser::Annotations()
- DocParser::parse in vendor/
doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ DocParser.php - Parses the given docblock string for annotations.
File
-
vendor/
doctrine/ annotations/ lib/ Doctrine/ Common/ Annotations/ DocParser.php, line 676
Class
- DocParser
- A parser for docblock annotations.
Namespace
Doctrine\Common\AnnotationsCode
private function Annotations() : array {
$annotations = [];
while ($this->lexer->lookahead !== null) {
if ($this->lexer->lookahead->type !== DocLexer::T_AT) {
$this->lexer
->moveNext();
continue;
}
// make sure the @ is preceded by non-catchable pattern
if ($this->lexer->token !== null && $this->lexer->lookahead->position === $this->lexer->token->position + strlen($this->lexer->token->value)) {
$this->lexer
->moveNext();
continue;
}
// make sure the @ is followed by either a namespace separator, or
// an identifier token
$peek = $this->lexer
->glimpse();
if ($peek === null || $peek->type !== DocLexer::T_NAMESPACE_SEPARATOR && !in_array($peek->type, self::$classIdentifiers, true) || $peek->position !== $this->lexer->lookahead->position + 1) {
$this->lexer
->moveNext();
continue;
}
$this->isNestedAnnotation = false;
$annot = $this->Annotation();
if ($annot === false) {
continue;
}
$annotations[] = $annot;
}
return $annotations;
}