Skip to content

Commit bebdd07

Browse files
committed
[TwigBridge] simplified code
1 parent 2dff183 commit bebdd07

File tree

1 file changed

+3
-17
lines changed

1 file changed

+3
-17
lines changed

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

Lines changed: 3 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,15 @@ public function compile(\Twig_Compiler $compiler)
5555
}
5656

5757
if (null !== $vars) {
58-
$compiler->raw('array_merge(');
59-
$this->compileDefaults($compiler, $defaults);
6058
$compiler
59+
->raw('array_merge(')
60+
->subcompile($defaults)
6161
->raw(', ')
6262
->subcompile($this->getNode('vars'))
6363
->raw(')')
6464
;
6565
} else {
66-
$this->compileDefaults($compiler, $defaults);
66+
$compiler->subcompile($defaults);
6767
}
6868

6969
$compiler
@@ -79,20 +79,6 @@ public function compile(\Twig_Compiler $compiler)
7979
$compiler->raw(");\n");
8080
}
8181

82-
protected function compileDefaults(\Twig_Compiler $compiler, \Twig_Node_Expression_Array $defaults)
83-
{
84-
$compiler->raw('array(');
85-
foreach ($defaults as $name => $default) {
86-
$compiler
87-
->repr($name)
88-
->raw(' => ')
89-
->subcompile($default)
90-
->raw(', ')
91-
;
92-
}
93-
$compiler->raw(')');
94-
}
95-
9682
protected function compileString(\Twig_NodeInterface $body, \Twig_Node_Expression_Array $vars)
9783
{
9884
if ($body instanceof \Twig_Node_Expression_Constant) {

0 commit comments

Comments
 (0)