8000 removed on indirection · symfony/symfony@448cda7 · GitHub
[go: up one dir, main page]

Skip to content

Commit 448cda7

Browse files
committed
removed on indirection
1 parent e4442a4 commit 448cda7

File tree

6 files changed

+15
-23
lines changed

6 files changed

+15
-23
lines changed

src/Symfony/Bridge/Twig/Extension/FormExtension.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@
2323
*/
2424
class FormExtension extends \Twig_Extension implements \Twig_Extension_InitRuntimeInterface
2525
{
26-
/**
27-
* This property is public so that it can be accessed directly from compiled
28-
* templates without having to call a getter, which slightly decreases performance.
29-
*
30-
* @var TwigRendererInterface
31-
*/
32-
public $renderer;
33-
3426
public function __construct(TwigRendererInterface $renderer)
3527
{
3628
$this->renderer = $renderer;

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function compile(\Twig_Compiler $compiler)
3030
{
3131
$compiler
3232
->addDebugInfo($this)
33-
->write('$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->setTheme(')
33+
->write('$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->setTheme(')
3434
->subcompile($this->getNode('form'))
3535
->raw(', ')
3636
->subcompile($this->getNode('resources'))

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function compile(\Twig_Compiler $compiler)
2525
{
2626
$compiler->addDebugInfo($this);
2727
$arguments = iterator_to_array($this->getNode('arguments'));
28-
$compiler->write('$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->renderBlock(');
28+
$compiler->write('$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->renderBlock(');
2929

3030
if (isset($arguments[0])) {
3131
$compiler->subcompile($arguments[0]);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ class SearchAndRenderBlockNode extends \Twig_Node_Expression_Function
1919
public function compile(\Twig_Compiler $compiler)
2020
{
2121
$compiler->addDebugInfo($this);
22-
$compiler->raw('$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(');
22+
$compiler->raw('$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(');
2323

2424
preg_match('/_([^_]+)$/', $this->getAttribute('name'), $matches);
2525

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testCompile()
4545

4646
$this->assertEquals(
4747
sprintf(
48-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->setTheme(%s, array(0 => "tpl1", 1 => "tpl2"));',
48+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->setTheme(%s, array(0 => "tpl1", 1 => "tpl2"));',
4949
$this->getVariableGetter('form')
5050
),
5151
trim($compiler->compile($node)->getSource())
@@ -57,7 +57,7 @@ public function testCompile()
5757

5858
$this->assertEquals(
5959
sprintf(
60-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->setTheme(%s, "tpl1");',
60+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->setTheme(%s, "tpl1");',
6161
$this->getVariableGetter('form')
6262
),
6363
trim($compiler->compile($node)->getSource())

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

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function testCompileWidget()
2727

2828
$this->assertEquals(
2929
sprintf(
30-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'widget\')',
30+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'widget\')',
3131
$this->getVariableGetter('form')
3232
),
3333
trim($compiler->compile($node)->getSource())
@@ -50,7 +50,7 @@ public function testCompileWidgetWithVariables()
5050

5151
$this->assertEquals(
5252
sprintf(
53-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'widget\', array("foo" => "bar"))',
53+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'widget\', array("foo" => "bar"))',
5454
$this->getVariableGetter('form')
5555
),
5656
trim($compiler->compile($node)->getSource())
@@ -70,7 +70,7 @@ public function testCompileLabelWithLabel()
7070

7171
$this->assertEquals(
7272
sprintf(
73-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'label\', array("label" => "my label"))',
73+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("label" => "my label"))',
7474
$this->getVariableGetter('form')
7575
),
7676
trim($compiler->compile($node)->getSource())
@@ -92,7 +92,7 @@ public function testCompileLabelWithNullLabel()
9292
// Otherwise the default label is overwritten with null.
9393
$this->assertEquals(
9494
sprintf(
95-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'label\')',
95+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\')',
9696
$this->getVariableGetter('form')
9797
),
9898
trim($compiler->compile($node)->getSource())
@@ -114,7 +114,7 @@ public function testCompileLabelWithEmptyStringLabel()
114114
// Otherwise the default label is overwritten with null.
115115
$this->assertEquals(
116116
sprintf(
117-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'label\')',
117+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\')',
118118
$this->getVariableGetter('form')
119119
),
120120
trim($compiler->compile($node)->getSource())
@@ -133,7 +133,7 @@ public function testCompileLabelWithDefaultLabel()
133133

134134
$this->assertEquals(
135135
sprintf(
136-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'label\')',
136+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\')',
137137
$this->getVariableGetter('form')
138138
),
139139
trim($compiler->compile($node)->getSource())
@@ -160,7 +160,7 @@ public function testCompileLabelWithAttributes()
160160
// https://github.com/symfony/symfony/issues/5029
161161
$this->assertEquals(
162162
sprintf(
163-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'label\', array("foo" => "bar"))',
163+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar"))',
164164
$this->getVariableGetter('form')
165165
),
166166
trim($compiler->compile($node)->getSource())
@@ -186,7 +186,7 @@ public function testCompileLabelWithLabelAndAttributes()
186186

187187
$this->assertEquals(
188188
sprintf(
189-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in argument"))',
189+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in argument"))',
190190
$this->getVariableGetter('form')
191191
),
192192
trim($compiler->compile($node)->getSource())
@@ -217,7 +217,7 @@ public function testCompileLabelWithLabelThatEvaluatesToNull()
217217
// https://github.com/symfony/symfony/issues/5029
218218
$this->assertEquals(
219219
sprintf(
220-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'label\', (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))',
220+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))',
221221
$this->getVariableGetter('form')
222222
),
223223
trim($compiler->compile($node)->getSource())
@@ -254,7 +254,7 @@ public function testCompileLabelWithLabelThatEvaluatesToNullAndAttributes()
254254
// https://github.com/symfony/symfony/issues/5029
255255
$this->assertEquals(
256256
sprintf(
257-
'$this->env->getExtension(\'Symfony\Bridge\Twig\Extension\FormExtension\')->renderer->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in attributes") + (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))',
257+
'$this->env->getRuntime(\'Symfony\Bridge\Twig\Form\TwigRenderer\')->searchAndRenderBlock(%s, \'label\', array("foo" => "bar", "label" => "value in attributes") + (twig_test_empty($_label_ = ((true) ? (null) : (null))) ? array() : array("label" => $_label_)))',
258258
$this->getVariableGetter('form')
259259
),
260260
trim($compiler->compile($node)->getSource())

0 commit comments

Comments
 (0)
0