Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit bf12a8f

Browse filesBrowse files
committed
[TwigBridge] Remove usage of Node() instantiations
1 parent dcb690a commit bf12a8f
Copy full SHA for bf12a8f

File tree

6 files changed

+24
-23
lines changed
Filter options

6 files changed

+24
-23
lines changed

‎src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/NodeVisitor/TranslationDefaultDomainNodeVisitor.php
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
use Twig\Node\Expression\NameExpression;
2323
use Twig\Node\ModuleNode;
2424
use Twig\Node\Node;
25+
use Twig\Node\Nodes;
2526
use Twig\Node\SetNode;
2627
use Twig\NodeVisitor\NodeVisitorInterface;
2728

@@ -53,7 +54,7 @@ public function enterNode(Node $node, Environment $env): Node
5354
$name = new AssignNameExpression($var, $node->getTemplateLine());
5455
$this->scope->set('domain', new NameExpression($var, $node->getTemplateLine()));
5556

56-
return new SetNode(false, new Node([$name]), new Node([$node->getNode('expr')]), $node->getTemplateLine());
57+
return new SetNode(false, new Nodes([$name]), new Nodes([$node->getNode('expr')]), $node->getTemplateLine());
5758
}
5859
}
5960

‎src/Symfony/Bridge/Twig/Tests/Node/DumpNodeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Node/DumpNodeTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
use Twig\Environment;
1818
use Twig\Loader\LoaderInterface;
1919
use Twig\Node\Expression\NameExpression;
20-
use Twig\Node\Node;
20+
use Twig\Node\Nodes;
2121

2222
class DumpNodeTest extends TestCase
2323
{
@@ -71,7 +71,7 @@ public function testIndented()
7171

7272
public function testOneVar()
7373
{
74-
$vars = new Node([
74+
$vars = new Nodes([
7575
new NameExpression('foo', 7),
7676
]);
7777
$node = new DumpNode('bar', $vars, 7);
@@ -94,7 +94,7 @@ public function testOneVar()
9494

9595
public function testMultiVars()
9696
{
97-
$vars = new Node([
97+
$vars = new Nodes([
9898
new NameExpression('foo', 7),
9999
new NameExpression('bar', 7),
100100
]);

‎src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Node/FormThemeTest.php
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
use Twig\Node\Expression\ArrayExpression;
2323
use Twig\Node\Expression\ConstantExpression;
2424
use Twig\Node\Expression\NameExpression;
25-
use Twig\Node\Node;
25+
use Twig\Node\Nodes;
2626

2727
class FormThemeTest extends TestCase
2828
{
@@ -31,7 +31,7 @@ class FormThemeTest extends TestCase
3131
public function testConstructor()
3232
{
3333
$form = new NameExpression('form', 0);
34-
$resources = new Node([
34+
$resources = new Nodes([
3535
new ConstantExpression('tpl1', 0),
3636
new ConstantExpression('tpl2', 0),
3737
]);

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

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/Node/SearchAndRenderBlockNodeTest.php
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@
2222
use Twig\Node\Expression\ConditionalExpression;
2323
use Twig\Node\Expression\ConstantExpression;
2424
use Twig\Node\Expression\NameExpression;
25-
use Twig\Node\Node;
25+
use Twig\Node\Nodes;
2626
use Twig\TwigFunction;
2727

2828
class SearchAndRenderBlockNodeTest extends TestCase
2929
{
3030
public function testCompileWidget()
3131
{
32-
$arguments = new Node([
32+
$arguments = new Nodes([
3333
new NameExpression('form', 0),
3434
]);
3535

@@ -52,7 +52,7 @@ public function testCompileWidget()
5252

5353
public function testCompileWidgetWithVariables()
5454
{
55-
$arguments = new Node([
55+
$arguments = new Nodes([
5656
new NameExpression('form', 0),
5757
new ArrayExpression([
5858
new ConstantExpression('foo', 0),
@@ -79,7 +79,7 @@ public function testCompileWidgetWithVariables()
7979

8080
public function testCompileLabelWithLabel()
8181
{
82-
$arguments = new Node([
82+
$arguments = new Nodes([
8383
new NameExpression('form', 0),
8484
new ConstantExpression('my label', 0),
8585
]);
@@ -103,7 +103,7 @@ public function testCompileLabelWithLabel()
103103

104104
public function testCompileLabelWithNullLabel()
105105
{
106-
$arguments = new Node([
106+
$arguments = new Nodes([
107107
new NameExpression('form', 0),
108108
new ConstantExpression(null, 0),
109109
]);
@@ -129,7 +129,7 @@ public function testCompileLabelWithNullLabel()
129129

130130
public function testCompileLabelWithEmptyStringLabel()
131131
{
132-
$arguments = new Node([
132+
$arguments = new Nodes([
133133
new NameExpression('form', 0),
134134
new ConstantExpression('', 0),
135135
]);
@@ -155,7 +155,7 @@ public function testCompileLabelWithEmptyStringLabel()
155155

156156
public function testCompileLabelWithDefaultLabel()
157157
{
158-
$arguments = new Node([
158+
$arguments = new Nodes([
159159
new NameExpression('form', 0),
160160
]);
161161

@@ -178,7 +178,7 @@ public function testCompileLabelWithDefaultLabel()
178178

179179
public function testCompileLabelWithAttributes()
180180
{
181-
$arguments = new Node([
181+
$arguments = new Nodes([
182182
new NameExpression('form', 0),
183183
new ConstantExpression(null, 0),
184184
new ArrayExpression([
@@ -209,7 +209,7 @@ public function testCompileLabelWithAttributes()
209209

210210
public function testCompileLabelWithLabelAndAttributes()
211211
{
212-
$arguments = new Node([
212+
$arguments = new Nodes([
213213
new NameExpression('form', 0),
214214
new ConstantExpression('value in argument', 0),
215215
new ArrayExpression([
@@ -239,7 +239,7 @@ public function testCompileLabelWithLabelAndAttributes()
239239

240240
public function testCompileLabelWithLabelThatEvaluatesToNull()
241241
{
242-
$arguments = new Node([
242+
$arguments = new Nodes([
243243
new NameExpression('form', 0),
244244
new ConditionalExpression(
245245
// if
@@ -275,7 +275,7 @@ public function testCompileLabelWithLabelThatEvaluatesToNull()
275275

276276
public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
277277
{
278-
$arguments = new Node([
278+
$arguments = new Nodes([
279279
new NameExpression('form', 0),
280280
new ConditionalExpression(
281281
// if

‎src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/NodeVisitor/TranslationNodeVisitorTest.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@
2121
use Twig\Node\Expression\FilterExpression;
2222
use Twig\Node\Expression\NameExpression;
2323
use Twig\Node\Node;
24+
use Twig\Node\Nodes;
2425
use Twig\TwigFilter;
25-
use Twig\TwigFunction;
2626

2727
class TranslationNodeVisitorTest extends TestCase
2828
{
@@ -45,7 +45,7 @@ public function testMessageExtractionWithInvalidDomainNode()
4545
$node = new FilterExpression(
4646
new ConstantExpression($message, 0),
4747
new TwigFilter('trans'),
48-
new Node([
48+
new Nodes([
4949
new ArrayExpression([], 0),
5050
new NameExpression('variable', 0),
5151
]),
@@ -55,7 +55,7 @@ public function testMessageExtractionWithInvalidDomainNode()
5555
$node = new FilterExpression(
5656
new ConstantExpression($message, 0),
5757
new ConstantExpression('trans', 0),
58-
new Node([
58+
new Nodes([
5959
new ArrayExpression([], 0),
6060
new NameExpression('variable', 0),
6161
]),

‎src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php

Copy file name to clipboardExpand all lines: src/Symfony/Bridge/Twig/Tests/NodeVisitor/TwigNodeProvider.php
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
use Twig\Node\Expression\ConstantExpression;
2020
use Twig\Node\Expression\FilterExpression;
2121
use Twig\Node\ModuleNode;
22-
use Twig\Node\Node;
22+
use Twig\Node\Nodes;
2323
use Twig\Source;
2424
use Twig\TwigFilter;
2525

@@ -51,15 +51,15 @@ public static function getTransFilter($message, $domain = null, $arguments = nul
5151
return new FilterExpression(
5252
new ConstantExpression($message, 0),
5353
new ConstantExpression('trans', 0),
54-
new Node($arguments),
54+
new Nodes($arguments),
5555
0
5656
);
5757
}
5858

5959
return new FilterExpression(
6060
new ConstantExpression($message, 0),
6161
new TwigFilter('trans'),
62-
new Node($arguments),
62+
new Nodes($arguments),
6363
0
6464
);
6565
}

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.