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

Breadcrumb

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

function ConstExprParser::parseDoctrineString

* This method is supposed to be called with TokenIterator after reading TOKEN_DOUBLE_QUOTED_STRING and shifting * to the next token.

1 call to ConstExprParser::parseDoctrineString()
ConstExprParser::parse in vendor/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php

File

vendor/phpstan/phpdoc-parser/src/Parser/ConstExprParser.php, line 276

Class

ConstExprParser

Namespace

PHPStan\PhpDocParser\Parser

Code

public function parseDoctrineString(string $text, TokenIterator $tokens) : Ast\ConstExpr\DoctrineConstExprStringNode {
    // Because of how Lexer works, a valid Doctrine string
    // can consist of a sequence of TOKEN_DOUBLE_QUOTED_STRING and TOKEN_DOCTRINE_ANNOTATION_STRING
    while ($tokens->isCurrentTokenType(Lexer::TOKEN_DOUBLE_QUOTED_STRING, Lexer::TOKEN_DOCTRINE_ANNOTATION_STRING)) {
        $text .= $tokens->currentTokenValue();
        $tokens->next();
    }
    return new Ast\ConstExpr\DoctrineConstExprStringNode(Ast\ConstExpr\DoctrineConstExprStringNode::unescape($text));
}
RSS feed
Powered by Drupal