minor #23435 [TwigBridge] cleaner implementation of the TwigRenderer (Tobion)
This PR was merged into the 2.7 branch.
Discussion
----------
[TwigBridge] cleaner implementation of the TwigRenderer
| Q | A
| ------------- | ---
| Branch? | 2.7
| Bug fix? | no
| New feature? | no <!-- don't forget updating src/**/CHANGELOG.md files -->
| BC breaks? | no
| Deprecations? | no <!-- don't forget updating UPGRADE-*.md files -->
| Tests pass? | yes
| Fixed tickets | https://github.com/symfony/symfony/pull/23432#discussion_r125880092
| License | MIT
| Doc PR |
<!--
- Bug fixes must be submitted against the lowest branch where they apply
(lowest branches are regularly merged to upper ones so they get the fixes too).
- Features and deprecations must be submitted against the 3.4,
legacy code removals go to the master branch.
- Please fill in this template according to the PR you're about to submit.
- Replace this comment by a description of what your PR is solving.
-->
Commits
-------
c7c5ba8
[TwigBridge] cleaner implementation of the TwigRenderer
This commit is contained in:
commit
62fdf9c72b
|
@ -19,16 +19,19 @@ use Twig\Environment;
|
|||
*/
|
||||
class TwigRenderer extends FormRenderer implements TwigRendererInterface
|
||||
{
|
||||
/**
|
||||
* @var TwigRendererEngineInterface
|
||||
*/
|
||||
private $engine;
|
||||
|
||||
public function __construct(TwigRendererEngineInterface $engine, $csrfTokenManager = null)
|
||||
{
|
||||
parent::__construct($engine, $csrfTokenManager);
|
||||
}
|
||||
|
||||
$this->engine = $engine;
|
||||
/**
|
||||
* Returns the engine used by this renderer.
|
||||
*
|
||||
* @return TwigRendererEngineInterface The renderer engine
|
||||
*/
|
||||
public function getEngine()
|
||||
{
|
||||
return parent::getEngine();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -36,6 +39,6 @@ class TwigRenderer extends FormRenderer implements TwigRendererInterface
|
|||
*/
|
||||
public function setEnvironment(Environment $environment)
|
||||
{
|
||||
$this->engine->setEnvironment($environment);
|
||||
$this->getEngine()->setEnvironment($environment);
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue