function DocParser::findInitialTokenPosition
Same name in this branch
- 11.1.x core/lib/Drupal/Component/Annotation/Doctrine/DocParser.php \Drupal\Component\Annotation\Doctrine\DocParser::findInitialTokenPosition()
Finds the first valid annotation
1 call to DocParser::findInitialTokenPosition()
- 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 376
Class
- DocParser
- A parser for docblock annotations.
Namespace
Doctrine\Common\AnnotationsCode
private function findInitialTokenPosition(string $input) : ?int {
$pos = 0;
// search for first valid annotation
while (($pos = strpos($input, '@', $pos)) !== false) {
$preceding = substr($input, $pos - 1, 1);
// if the @ is preceded by a space, a tab or * it is valid
if ($pos === 0 || $preceding === ' ' || $preceding === '*' || $preceding === "\t") {
return $pos;
}
$pos++;
}
return null;
}