8000 Merge branch '6.4' into 7.1 · symfony/symfony@aacfaa2 · GitHub
[go: up one dir, main page]

Skip to content

Commit aacfaa2

Browse files
committed
Merge branch '6.4' into 7.1
* 6.4: fix Twig 3.17 compatibility
2 parents b7d3227 + 8c8bab2 commit aacfaa2

File tree

1 file changed

+49
-39
lines changed

1 file changed

+49
-39
lines changed

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

Lines changed: 49 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Twig\Node\Expression\ConditionalExpression;
2323
use Twig\Node\Expression\ConstantExpression;
2424
use Twig\Node\Expression\NameExpression;
25+
use Twig\Node\Expression\Ternary\ConditionalTernary;
2526
use Twig\Node\Expression\Variable\ContextVariable;
2627
use Twig\Node\Node;
2728
use Twig\Node\Nodes;
@@ -308,32 +309,32 @@ public function testCompileLabelWithLabelAndAttributes()
308309

309310
public function testCompileLabelWithLabelThatEvaluatesToNull()
310311
{
312+
if (class_exists(ConditionalTernary::class)) {
313+
$conditional = new ConditionalTernary(
314+
// if
315+
new ConstantExpression(true, 0),
316+
// then
317+
new ConstantExpression(null, 0),
318+
// else
319+
new ConstantExpression(null, 0),
320+
0
321+
);
322+
} else {
323+
$conditional = new ConditionalExpression(
324+
// if
325+
new ConstantExpression(true, 0),
326+
// then
327+
new ConstantExpression(null, 0),
328+
// else
329+
new ConstantExpression(null, 0),
330+
0
331+
);
332+
}
333+
311334
if (class_exists(Nodes::class)) {
312-
$arguments = new Nodes([
313-
new ContextVariable('form', 0),
314-
new ConditionalExpression(
315-
// if
316-
new ConstantExpression(true, 0),
317-
// then
318-
new ConstantExpression(null, 0),
319-
// else
320-
new ConstantExpression(null, 0),
321-
0
322-
),
323-
]);
335+
$arguments = new Nodes([new ContextVariable('form', 0), $conditional]);
324336
} else {
325-
$arguments = new Node([
326-
new NameExpression('form', 0),
327-
new ConditionalExpression(
328-
// if
329-
new ConstantExpression(true, 0),
330-
// then
331-
new ConstantExpression(null, 0),
332-
// else
333-
new ConstantExpression(null, 0),
334-
0
335-
),
336-
]);
337+
$arguments = new Node([new NameExpression('form', 0), $conditional]);
337338
}
338339

339340
if (class_exists(FirstClassTwigCallableReady::class)) {
@@ -359,18 +360,32 @@ public function testCompileLabelWithLabelThatEvaluatesToNull()
359360

360361
public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
361362
{
363+
if (class_exists(ConditionalTernary::class)) {
364+
$conditional = new ConditionalTernary(
365+
// if
366+
new ConstantExpression(true, 0),
367+
// then
368+
new ConstantExpression(null, 0),
369+
// else
370+
new ConstantExpression(null, 0),
371+
0
372+
);
373+
} else {
374+
$conditional = new ConditionalExpression(
375+
// if
376+
new ConstantExpression(true, 0),
377+
// then
378+
new ConstantExpression(null, 0),
379+
// else
380+
new ConstantExpression(null, 0),
381+
0
382+
);
383+
}
384+
362385
if (class_exists(Nodes::class)) {
363386
$arguments = new Nodes([
364387
new ContextVariable('form' 57AE , 0),
365-
new ConditionalExpression(
366-
// if
367-
new ConstantExpression(true, 0),
368-
// then
369-
new ConstantExpression(null, 0),
370-
// else
371-
new ConstantExpression(null, 0),
372-
0
373-
),
388+
$conditional,
374389
new ArrayExpression([
375390
new ConstantExpression('foo', 0),
376391
new ConstantExpression('bar', 0),
@@ -381,12 +396,7 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
381396
} else {
382397
$arguments = new Node([
383398
new NameExpression('form', 0),
384-
new ConditionalExpression(
385-
new ConstantExpression(true, 0),
386-
new ConstantExpression(null, 0),
387-
new ConstantExpression(null, 0),
388-
0
389-
),
399+
$conditional,
390400
new ArrayExpression([
391401
new ConstantExpression('foo', 0),
392402
new ConstantExpression('bar', 0),

0 commit comments

Comments
 (0)
0