8000 bug #53913 [TwigBridge] Fix compat with Twig v3.9 (nicolas-grekas) · symfony/symfony@8306a88 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8306a88

Browse files
bug #53913 [TwigBridge] Fix compat with Twig v3.9 (nicolas-grekas)
This PR was merged into the 5.4 branch. Discussion ---------- [TwigBridge] Fix compat with Twig v3.9 | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Issues | - | License | MIT This PR relies on twigphp/Twig#3999 Commits ------- f563a4c [TwigBridge] Fix compat with Twig v3.9
2 parents 8802b0e + f563a4c commit 8306a88

File tree

15 files changed

+25
-14
lines changed

15 files changed

+25
-14
lines changed

composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"friendsofphp/proxy-manager-lts": "^1.0.2",
3838
"doctrine/event-manager": "~1.0",
3939
"doctrine/persistence": "^2|^3",
40-
"twig/twig": "^2.13|~3.8.0",
40+
"twig/twig": "^2.13|^3.0.4",
4141
"psr/cache": "^1.0|^2.0",
4242
"psr/container": "^1.1.1",
4343
"psr/event-dispatcher": "^1.0",

src/Symfony/Bridge/Twig/Node/DumpNode.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\YieldReady;
1415
use Twig\Compiler;
1516
use Twig\Node\Node;
1617

1718
/**
1819
* @author Julien Galenski <julien.galenski@gmail.com>
1920
*/
21+
#[YieldReady]
2022
final class DumpNode extends Node
2123
{
2224
private $varPrefix;

src/Symfony/Bridge/Twig/Node/FormThemeNode.php

+2
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@
1212
namespace Symfony\Bridge\Twig\Node;
1313

1414
use Symfony\Component\Form\FormRenderer;
15+
use Twig\Attribute\YieldReady;
1516
use Twig\Compiler;
1617
use Twig\Node\Node;
1718

1819
/**
1920
* @author Fabien Potencier <fabien@symfony.com>
2021
*/
22+
#[YieldReady]
2123
final class FormThemeNode extends Node
2224
{
2325
public function __construct(Node $form, Node $resources, int $lineno, ?string $tag = null, bool $only = false)

src/Symfony/Bridge/Twig/Node/StopwatchNode.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\YieldReady;
1415
use Twig\Compiler;
1516
use Twig\Node\Expression\AssignNameExpression;
1617
use Twig\Node\Node;
@@ -20,6 +21,7 @@
2021
*
2122
* @author Wouter J <wouter@wouterj.nl>
2223
*/
24+
#[YieldReady]
2325
final class StopwatchNode extends Node
2426
{
2527
public function __construct(Node $name, Node $body, AssignNameExpression $var, int $lineno = 0, ?string $tag = null)

src/Symfony/Bridge/Twig/Node/TransDefaultDomainNode.php

+2
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,15 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
F438 use Twig\Attribute\YieldReady;
1415
use Twig\Compiler;
1516
use Twig\Node\Expression\AbstractExpression;
1617
use Twig\Node\Node;
1718

1819
/**
1920
* @author Fabien Potencier <fabien@symfony.com>
2021
*/
22+
#[YieldReady]
2123
final class TransDefaultDomainNode extends Node
2224
{
2325
public function __construct(AbstractExpression $expr, int $lineno = 0, ?string $tag = null)

src/Symfony/Bridge/Twig/Node/TransNode.php

+4-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bridge\Twig\Node;
1313

14+
use Twig\Attribute\YieldReady;
1415
use Twig\Compiler;
1516
use Twig\Node\Expression\AbstractExpression;
1617
use Twig\Node\Expression\ArrayExpression;
@@ -22,6 +23,7 @@
2223
/**
2324
* @author Fabien Potencier <fabien@symfony.com>
2425
*/
26+
#[YieldReady]
2527
final class TransNode extends Node
2628
{
2729
public function __construct(Node $body, ?Node $domain = null, ?AbstractExpression $count = null, ?AbstractExpression $vars = null, ?AbstractExpression $locale = null, int $lineno = 0, ?string $tag = null)
@@ -53,9 +55,10 @@ public function compile(Compiler $compiler): void
5355
$vars = null;
5456
}
5557
[$msg, $defaults] = $this->compileString($this->getNode('body'), $defaults, (bool) $vars);
58+
$display = class_exists(YieldReady::class) ? 'yield' : 'echo';
5659

5760
$compiler
58-
->write('echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans(')
61+
->write($display.' $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans(')
5962
->subcompile($msg)
6063
;
6164

src/Symfony/Bridge/Twig/Tests/Node/TransNodeTest.php

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use PHPUnit\Framework\TestCase;
1515
use Symfony\Bridge\Twig\Node\TransNode;
16+
use Twig\Attribute\YieldReady;
1617
use Twig\Compiler;
1718
use Twig\Environment;
1819
use Twig\Loader\LoaderInterface;
@@ -35,7 +36,8 @@ public function testCompileStrict()
3536

3637
$this->assertEquals(
3738
sprintf(
38-
'echo $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans("trans %%var%%", array_merge(["%%var%%" => %s], %s), "messages");',
39+
'%s $this->env->getExtension(\'Symfony\Bridge\Twig\Extension\TranslationExtension\')->trans("trans %%var%%", array_merge(["%%var%%" => %s], %s), "messages");',
40+
class_exists(YieldReady::class) ? 'yield' : 'echo',
3941
$this->getVariableGetterWithoutStrictCheck('var'),
4042
$this->getVariableGetterWithStrictCheck('foo')
4143
),

src/Symfony/Bridge/Twig/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
"php": ">=7.2.5",
2020
"symfony/polyfill-php80": "^1.16",
2121
"symfony/translation-contracts": "^1.1|^2|^3",
22-
"twig/twig": "^2.13|~3.8.0"
22+
"twig/twig": "^2.13|^3.0.4"
2323
},
2424
"require-dev": {
2525
"doctrine/annotations": "^1.12|^2",

src/Symfony/Bundle/FrameworkBundle/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"symfony/property-info": "^4.4|^5.0|^6.0",
6767
"symfony/web-link": "^4.4|^5.0|^6.0",
6868
"phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
69-
"twig/twig": "^2.10|~3.8.0"
69+
"twig/twig": "^2.10|^3.0.4"
7070
},
7171
"conflict": {
7272
"doctrine/annotations": "<1.13.1",

src/Symfony/Bundle/SecurityBundle/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
"symfony/twig-bridge": "^4.4|^5.0|^6.0",
5252
"symfony/validator": "^4.4|^5.0|^6.0",
5353
"symfony/yaml": "^4.4|^5.0|^6.0",
54-
"twig/twig": "^2.13|~3.8.0"
54+
"twig/twig": "^2.13|^3.0.4"
5555
},
5656
"conflict": {
5757
"symfony/browser-kit": "<4.4",

src/Symfony/Bundle/TwigBundle/composer.json

Copy file name to clipboard
+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"symfony/http-kernel": "^5.0|^6.0",
2525
"symfony/polyfill-ctype": "~1.8",
2626
"symfony/polyfill-php80": "^1.16",
27-
"twig/twig": "^2.13|~3.8.0"
27+
"twig/twig": "^2.13|^3.0.4"
2828
},
2929
"require-dev": {
3030
"symfony/asset": "^4.4|^5.0|^6.0",

src/Symfony/Bundle/WebProfilerBundle/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
"symfony/polyfill-php80": "^1.16",
2424
"symfony/routing": "^4.4|^5.0|^6.0",
2525
"symfony/twig-bundle": "^4.4|^5.0|^6.0",
26-
"twig/twig": "^2.13|~3.8.0"
26+
"twig/twig": "^2.13|^3.0.4"
2727
},
2828
"require-dev": {
2929
"symfony/browser-kit": "^4.4|^5.0|^6.0",

src/Symfony/Component/HttpKernel/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@
4242
"symfony/translation": "^4.4|^5.0|^6.0",
4343
"symfony/translation-contracts": "^1.1|^2|^3",
4444
"psr/cache": "^1.0|^2.0|^3.0",
45-
"twig/twig": "^2.13|~3.8.0"
45+
"twig/twig": "^2.13|^3.0.4"
4646
},
4747
"provide": {
4848
"psr/log-implementation": "1.0|2.0"

src/Symfony/Component/VarDumper/Tests/Dumper/CliDumperTest.php

+2-4
Original file line numberDiff line numberDiff line change
@@ -370,9 +370,7 @@ public function testThrowingCaster()
370370
› twig source
371371
372372
}
373-
%s%eTemplate.php:%d { …}
374-
%s%eTemplate.php:%d { …}
375-
%s%eTemplate.php:%d { …}
373+
%A%eTemplate.php:%d { …}
376374
%s%eTests%eDumper%eCliDumperTest.php:%d { …}
377375
%A }
378376
}
@@ -572,7 +570,7 @@ public function testCollapse()
572570
],
573571
[
574572
'bar' => 123,
575-
]
573+
],
576574
]);
577575

578576
$dumper = new CliDumper();

src/Symfony/Component/VarDumper/composer.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
"symfony/http-kernel": "^4.4|^5.0|^6.0",
2727
"symfony/process": "^4.4|^5.0|^6.0",
2828
"symfony/uid": "^5.1|^6.0",
29-
"twig/twig": "^2.13|~3.8.0"
29+
"twig/twig": "^2.13|^3.0.4"
3030
},
3131
"conflict": {
3232
"symfony/console": "<4.4"

0 commit comments

Comments
 (0)
0