Augmentation vers version 3.3.0

This commit is contained in:
Gauvain Boiché
2020-03-31 15:31:03 +02:00
parent d926806907
commit a1864c0414
2618 changed files with 406015 additions and 31377 deletions

View File

@@ -12,14 +12,19 @@
namespace Symfony\Bridge\Twig\Form;
use Symfony\Component\Form\FormRenderer;
use Symfony\Component\Security\Csrf\CsrfTokenManagerInterface;
use Twig\Environment;
@trigger_error(sprintf('The %s class is deprecated since Symfony 3.4 and will be removed in 4.0. Use %s instead.', TwigRenderer::class, FormRenderer::class), E_USER_DEPRECATED);
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 3.4, to be removed in 4.0. Use Symfony\Component\Form\FormRenderer instead.
*/
class TwigRenderer extends FormRenderer implements TwigRendererInterface
{
public function __construct(TwigRendererEngineInterface $engine, $csrfTokenManager = null)
public function __construct(TwigRendererEngineInterface $engine, CsrfTokenManagerInterface $csrfTokenManager = null)
{
parent::__construct($engine, $csrfTokenManager);
}

View File

@@ -31,18 +31,34 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE
*/
private $template;
public function __construct(array $defaultThemes = [], Environment $environment = null)
{
if (null === $environment) {
@trigger_error(sprintf('Not passing a Twig Environment as the second argument for "%s" constructor is deprecated since Symfony 3.2 and won\'t be possible in 4.0.', static::class), E_USER_DEPRECATED);
}
parent::__construct($defaultThemes);
$this->environment = $environment;
}
/**
* {@inheritdoc}
*
* @deprecated since version 3.3, to be removed in 4.0
*/
public function setEnvironment(Environment $environment)
{
if ($this->environment) {
@trigger_error(sprintf('The "%s()" method is deprecated since Symfony 3.3 and will be removed in 4.0. Pass the Twig Environment as second argument of the constructor instead.', __METHOD__), E_USER_DEPRECATED);
}
$this->environment = $environment;
}
/**
* {@inheritdoc}
*/
public function renderBlock(FormView $view, $resource, $blockName, array $variables = array())
public function renderBlock(FormView $view, $resource, $blockName, array $variables = [])
{
$cacheKey = $view->vars[self::CACHE_KEY_VAR];
@@ -108,9 +124,11 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE
// Check the default themes once we reach the root view without success
if (!$view->parent) {
for ($i = \count($this->defaultThemes) - 1; $i >= 0; --$i) {
$this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]);
// CONTINUE LOADING (see doc comment)
if (!isset($this->useDefaultThemes[$cacheKey]) || $this->useDefaultThemes[$cacheKey]) {
for ($i = \count($this->defaultThemes) - 1; $i >= 0; --$i) {
$this->loadResourcesFromTheme($cacheKey, $this->defaultThemes[$i]);
// CONTINUE LOADING (see doc comment)
}
}
}
@@ -169,7 +187,7 @@ class TwigRendererEngine extends AbstractRendererEngine implements TwigRendererE
// theme is a reference and we don't want to change it.
$currentTheme = $theme;
$context = $this->environment->mergeGlobals(array());
$context = $this->environment->mergeGlobals([]);
// The do loop takes care of template inheritance.
// Add blocks from all templates in the inheritance tree, but avoid

View File

@@ -19,6 +19,8 @@ class_exists('Twig\Environment');
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 3.2, to be removed in 4.0.
*/
interface TwigRendererEngineInterface extends FormRendererEngineInterface
{

View File

@@ -19,6 +19,8 @@ class_exists('Twig\Environment');
/**
* @author Bernhard Schussek <bschussek@gmail.com>
*
* @deprecated since version 3.2, to be removed in 4.0.
*/
interface TwigRendererInterface extends FormRendererInterface
{