Skip to content
Snippets Groups Projects
Verified Commit 9c1da89f authored by Dave Long's avatar Dave Long
Browse files

Issue #3488365 by andypost: Upgrade twig/twig to 3.15.0

parent 6d78e0cf
No related branches found
No related tags found
19 merge requests!11380Issue #3490698 by catch, spokje: Bump MINIMUM_STABILITY back to 'stable' when...,!11239Issue #3507548: Allow workspace changes listing to show all items, without a pager,!11238Fix issue #3051797,!11213Issue #3506743 by tomislav.matokovic: Increasing the color contrast for the navigation block title against the background of the navigation sidebar to at least 4.5:1,!11147Draft: Try to avoid manually setting required cache contexts,!11108Issue #3490298 by nicxvan: Profiles can be missed in OOP hooks,!11093Drupal on MongoDB 11.1.x,!11017Issue #3502540: Add date filter for moderated content.,!11009Issue #3486972 migrate feed icon,!10999Cleaning up Taxonomy hooks and updating baseline.,!10977Issue #3501457: Fix path used in a A11y Test Admin,!10881Issue #3489329 by mfb, casey: symfony/http-foundation commit 32310ff breaks PathValidator,!10570Issue #3494197: Convert Twig engine hooks,!10567Issue #3494154: Index is not added if entity doesn't support revisions,!10548Revert "Issue #3478621 by catch, longwave, nicxvan: Add filecache to OOP hook attribute parsing",!10404Margin has been added,!10391Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...,!10388Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...,!10376Issue #3485117 by nexusnovaz, godotislate, nicxvan: Fix return type on...
Pipeline #351713 passed
Pipeline: drupal

#351715

    ......@@ -496,7 +496,7 @@
    "dist": {
    "type": "path",
    "url": "core",
    "reference": "f2db3b7ce714b984d75a410d178d58fa91648926"
    "reference": "35bc6bd18e1e0995a2d3887f713e5670c9cd5b39"
    },
    "require": {
    "asm89/stack-cors": "^2.1",
    ......@@ -545,7 +545,7 @@
    "symfony/serializer": "^7.2@beta",
    "symfony/validator": "^7.2@beta",
    "symfony/yaml": "^7.2@beta",
    "twig/twig": "^3.14.2"
    "twig/twig": "^3.15.0"
    },
    "conflict": {
    "drush/drush": "<12.4.3"
    ......@@ -4420,16 +4420,16 @@
    },
    {
    "name": "twig/twig",
    "version": "v3.14.2",
    "version": "v3.15.0",
    "source": {
    "type": "git",
    "url": "https://github.com/twigphp/Twig.git",
    "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a"
    "reference": "2d5b3964cc21d0188633d7ddce732dc8e874db02"
    },
    "dist": {
    "type": "zip",
    "url": "https://api.github.com/repos/twigphp/Twig/zipball/0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a",
    "reference": "0b6f9d8370bb3b7f1ce5313ed8feb0fafd6e399a",
    "url": "https://api.github.com/repos/twigphp/Twig/zipball/2d5b3964cc21d0188633d7ddce732dc8e874db02",
    "reference": "2d5b3964cc21d0188633d7ddce732dc8e874db02",
    "shasum": ""
    },
    "require": {
    ......@@ -4483,7 +4483,7 @@
    ],
    "support": {
    "issues": "https://github.com/twigphp/Twig/issues",
    "source": "https://github.com/twigphp/Twig/tree/v3.14.2"
    "source": "https://github.com/twigphp/Twig/tree/v3.15.0"
    },
    "funding": [
    {
    ......@@ -4495,7 +4495,7 @@
    "type": "tidelift"
    }
    ],
    "time": "2024-11-07T12:36:22+00:00"
    "time": "2024-11-17T15:59:19+00:00"
    }
    ],
    "packages-dev": [
    ......
    ......@@ -62,6 +62,6 @@
    "symfony/var-dumper": "~v7.2.0-RC1",
    "symfony/var-exporter": "~v7.1.6",
    "symfony/yaml": "~v7.2.0-RC1",
    "twig/twig": "~v3.14.2"
    "twig/twig": "~v3.15.0"
    }
    }
    ......@@ -35,7 +35,7 @@
    "symfony/polyfill-iconv": "^1.26",
    "symfony/yaml": "^7.2@beta",
    "revolt/event-loop": "^1.0",
    "twig/twig": "^3.14.2",
    "twig/twig": "^3.15.0",
    "doctrine/annotations": "^2.0",
    "doctrine/lexer": "^2.0",
    "guzzlehttp/guzzle": "^7.5",
    ......
    ......@@ -9,6 +9,7 @@
    use Drupal\Core\Render\Component\Exception\InvalidComponentException;
    use Drupal\Core\Theme\ComponentPluginManager;
    use Twig\Environment;
    use Twig\Node\Nodes;
    use Twig\TwigFunction;
    use Twig\Node\Expression\ConstantExpression;
    use Twig\Node\Expression\FunctionExpression;
    ......@@ -57,24 +58,24 @@ public function leaveNode(Node $node, Environment $env): ?Node {
    }
    $print_nodes[] = new PrintNode(new FunctionExpression(
    new TwigFunction('attach_library', [$env->getExtension(TwigExtension::class), 'attachLibrary']),
    new Node([new ConstantExpression($component->getLibraryName(), $line)]),
    new Nodes([new ConstantExpression($component->getLibraryName(), $line)]),
    $line
    ), $line);
    $print_nodes[] = new PrintNode(new FunctionExpression(
    new TwigFunction('add_component_context', [$env->getExtension(ComponentsTwigExtension::class), 'addAdditionalContext'], ['needs_context' => TRUE]),
    new Node([new ConstantExpression($component_id, $line)]),
    new Nodes([new ConstantExpression($component_id, $line)]),
    $line
    ), $line);
    $print_nodes[] = new PrintNode(new FunctionExpression(
    new TwigFunction('validate_component_props', [$env->getExtension(ComponentsTwigExtension::class), 'validateProps'], ['needs_context' => TRUE]),
    new Node([new ConstantExpression($component_id, $line)]),
    new Nodes([new ConstantExpression($component_id, $line)]),
    $line
    ), $line);
    // Append the print nodes to the display_start node.
    $node->setNode(
    'display_start',
    new Node([
    new Nodes([
    $node->getNode('display_start'),
    ...$print_nodes,
    ]),
    ......@@ -84,7 +85,7 @@ public function leaveNode(Node $node, Environment $env): ?Node {
    // Append the closing comment to the display_end node.
    $node->setNode(
    'display_end',
    new Node([
    new Nodes([
    new PrintNode(new ConstantExpression(sprintf('<!-- %s Component end: %s -->', $emoji, $component_id), $line), $line),
    $node->getNode('display_end'),
    ])
    ......
    ......@@ -13,7 +13,9 @@
    use Twig\Node\Expression\GetAttrExpression;
    use Twig\Node\Expression\NameExpression;
    use Twig\Node\Expression\TempNameExpression;
    use Twig\Node\Expression\Variable\ContextVariable;
    use Twig\Node\Node;
    use Twig\Node\Nodes;
    use Twig\Node\PrintNode;
    /**
    ......@@ -178,7 +180,7 @@ protected function compileString(Node $body) {
    if (!is_null($args)) {
    $argName = $args->getAttribute('name');
    }
    $expr = new NameExpression($argName, $n->getTemplateLine());
    $expr = new ContextVariable($argName, $n->getTemplateLine());
    }
    $placeholder = sprintf('%s%s', $argPrefix, $argName);
    $text .= $placeholder;
    ......@@ -198,7 +200,7 @@ protected function compileString(Node $body) {
    }
    return [
    new Node([new ConstantExpression(trim($text), $body->getTemplateLine())]),
    new Nodes([new ConstantExpression(trim($text), $body->getTemplateLine())]),
    $tokens,
    ];
    }
    ......
    ......@@ -3,6 +3,7 @@
    namespace Drupal\Core\Template;
    use Twig\Environment;
    use Twig\Node\Nodes;
    use Twig\TwigFunction;
    use Twig\Node\Expression\FilterExpression;
    use Twig\Node\Expression\FunctionExpression;
    ......@@ -50,7 +51,7 @@ public function leaveNode(Node $node, Environment $env): ?Node {
    return new $class(
    new FunctionExpression(
    new TwigFunction('render_var', [$env->getExtension(TwigExtension::class), 'renderVar']),
    new Node([$node->getNode('expr')]),
    new Nodes([$node->getNode('expr')]),
    $line
    ),
    $line
    ......
    ......@@ -7,6 +7,7 @@
    use Twig\Node\Expression\NameExpression;
    use Twig\Node\ModuleNode;
    use Twig\Node\Node;
    use Twig\Node\Nodes;
    use Twig\NodeVisitor\NodeVisitorInterface;
    /**
    ......@@ -59,7 +60,7 @@ public function leaveNode(Node $node, Environment $env): ?Node {
    // At the end of the template, check the used variables are not deprecated.
    if ($node instanceof ModuleNode) {
    if (!empty($this->usedNames)) {
    $checkNode = new Node([new TwigNodeCheckDeprecations($this->usedNames), $node->getNode('display_end')]);
    $checkNode = new Nodes([new TwigNodeCheckDeprecations($this->usedNames), $node->getNode('display_end')]);
    $node->setNode('display_end', $checkNode);
    }
    }
    ......
    ......@@ -9,6 +9,7 @@
    use Twig\Environment;
    use Twig\Node\ModuleNode;
    use Twig\Node\Node;
    use Twig\Node\Nodes;
    use Twig\NodeVisitor\NodeVisitorInterface;
    /**
    ......@@ -46,11 +47,11 @@ public function enterNode(Node $node, Environment $env): Node {
    */
    public function leaveNode(Node $node, Environment $env): ?Node {
    if ($node instanceof ModuleNode) {
    $node->setNode('display_start', new Node([
    $node->setNode('display_start', new Nodes([
    new EnterProfileNode($this->extensionName, $this->varName),
    $node->getNode('display_start'),
    ]));
    $node->setNode('display_end', new Node([
    $node->setNode('display_end', new Nodes([
    new LeaveProfileNode($this->varName),
    $node->getNode('display_end'),
    ]));
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Finish editing this message first!
    Please register or to comment