bug #20882 [TwigBridge] fix constructor args check (xabbuh)

This PR was merged into the 3.2 branch.

Discussion
----------

[TwigBridge] fix constructor args check

| Q             | A
| ------------- | ---
| Branch?       | 3.2
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | symfony/symfony-docs#7242
| License       | MIT
| Doc PR        |

Commits
-------

fa82588 [TwigBridge] fix constructor args check
This commit is contained in:
Fabien Potencier 2016-12-13 08:15:19 +01:00
commit 8e19e2c302

View File

@ -31,7 +31,7 @@ class FormExtension extends \Twig_Extension implements \Twig_Extension_InitRunti
public function __construct($renderer = null)
{
if ($this->renderer instanceof TwigRendererInterface) {
if ($renderer instanceof TwigRendererInterface) {
@trigger_error(sprintf('Passing a Twig Form Renderer to the "%s" constructor is deprecated since version 3.2 and won\'t be possible in 4.0. Pass the Twig_Environment to the TwigRendererEngine constructor instead.', static::class), E_USER_DEPRECATED);
} elseif (null !== $renderer && !(is_array($renderer) && isset($renderer[0], $renderer[1]) && $renderer[0] instanceof ContainerInterface)) {
throw new \InvalidArgumentException(sprintf('Passing any arguments the constructor of %s is reserved for internal use.', __CLASS__));