Update Twig to v2.15.4

This commit is contained in:
slawkens
2023-02-02 10:37:45 +01:00
parent e552bcfe82
commit 130f7ba405
309 changed files with 3802 additions and 4005 deletions

View File

@@ -27,10 +27,8 @@ use Twig\Token;
* {% block content %}{% endblock %}
*
* @see https://twig.symfony.com/doc/templates.html#horizontal-reuse for details.
*
* @final
*/
class UseTokenParser extends AbstractTokenParser
final class UseTokenParser extends AbstractTokenParser
{
public function parse(Token $token)
{
@@ -44,22 +42,22 @@ class UseTokenParser extends AbstractTokenParser
$targets = [];
if ($stream->nextIf('with')) {
do {
$name = $stream->expect(Token::NAME_TYPE)->getValue();
$name = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue();
$alias = $name;
if ($stream->nextIf('as')) {
$alias = $stream->expect(Token::NAME_TYPE)->getValue();
$alias = $stream->expect(/* Token::NAME_TYPE */ 5)->getValue();
}
$targets[$name] = new ConstantExpression($alias, -1);
if (!$stream->nextIf(Token::PUNCTUATION_TYPE, ',')) {
if (!$stream->nextIf(/* Token::PUNCTUATION_TYPE */ 9, ',')) {
break;
}
} while (true);
}
$stream->expect(Token::BLOCK_END_TYPE);
$stream->expect(/* Token::BLOCK_END_TYPE */ 3);
$this->parser->addTrait(new Node(['template' => $template, 'targets' => new Node($targets)]));