[TwigBridge] Removed duplicated code from TwigRenderer
This commit is contained in:
parent
8b12bf967a
commit
1a9aca7152
@ -11,11 +11,7 @@
|
||||
|
||||
namespace Symfony\Bridge\Twig\Form;
|
||||
|
||||
use Symfony\Component\Form\Exception\UnexpectedTypeException;
|
||||
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderAdapter;
|
||||
use Symfony\Component\Form\Extension\Csrf\CsrfProvider\CsrfProviderInterface;
|
||||
use Symfony\Component\Form\FormRenderer;
|
||||
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
|
||||
|
||||
/**
|
||||
* @author Bernhard Schussek <bschussek@gmail.com>
|
||||
@ -29,12 +25,6 @@ class TwigRenderer extends FormRenderer implements TwigRendererInterface
|
||||
|
||||
public function __construct(TwigRendererEngineInterface $engine, $csrfTokenManager = null)
|
||||
{
|
||||
if ($csrfTokenManager instanceof CsrfProviderInterface) {
|
||||
$csrfTokenManager = new CsrfProviderAdapter($csrfTokenManager);
|
||||
} elseif (null !== $csrfTokenManager && !$csrfTokenManager instanceof CsrfTokenManagerInterface) {
|
||||
throw new UnexpectedTypeException($csrfTokenManager, 'CsrfProviderInterface or CsrfTokenManagerInterface');
|
||||
}
|
||||
|
||||
parent::__construct($engine, $csrfTokenManager);
|
||||
|
||||
$this->engine = $engine;
|
||||
|
@ -17,7 +17,6 @@
|
||||
],
|
||||
"require": {
|
||||
"php": ">=5.3.3",
|
||||
"symfony/security-csrf": "~2.4",
|
||||
"twig/twig": "~1.13,>=1.13.1"
|
||||
},
|
||||
"require-dev": {
|
||||
|
Reference in New Issue
Block a user