function PhpDocParser::parseDoctrineArrayItem
1 call to PhpDocParser::parseDoctrineArrayItem()
- PhpDocParser::parseDoctrineArgumentValue in vendor/
phpstan/ phpdoc-parser/ src/ Parser/ PhpDocParser.php - *
File
-
vendor/
phpstan/ phpdoc-parser/ src/ Parser/ PhpDocParser.php, line 768
Class
- PhpDocParser
- @phpstan-import-type ValueType from Doctrine\DoctrineArgument as DoctrineValueType
Namespace
PHPStan\PhpDocParser\ParserCode
private function parseDoctrineArrayItem(TokenIterator $tokens) : Doctrine\DoctrineArrayItem {
$startLine = $tokens->currentTokenLine();
$startIndex = $tokens->currentTokenIndex();
try {
$tokens->pushSavePoint();
$key = $this->parseDoctrineArrayKey($tokens);
if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_EQUAL)) {
if (!$tokens->tryConsumeTokenType(Lexer::TOKEN_COLON)) {
$tokens->consumeTokenType(Lexer::TOKEN_EQUAL);
// will throw exception
}
}
$value = $this->parseDoctrineArgumentValue($tokens);
$tokens->dropSavePoint();
return $this->enrichWithAttributes($tokens, new Doctrine\DoctrineArrayItem($key, $value), $startLine, $startIndex);
} catch (ParserException $e) {
$tokens->rollback();
return $this->enrichWithAttributes($tokens, new Doctrine\DoctrineArrayItem(null, $this->parseDoctrineArgumentValue($tokens)), $startLine, $startIndex);
}
}