Updating Symfony lib and dependencies:

Package operations: 2 installs, 23 updates, 0 removals
  - Updating psr/log (1.1.0 => 1.1.2)
  - Updating symfony/debug (v3.4.30 => v3.4.35)
  - Updating symfony/console (v3.4.30 => v3.4.35)
  - Updating symfony/dotenv (v3.4.30 => v3.4.35)
  - Updating symfony/routing (v3.4.30 => v3.4.35)
  - Updating symfony/finder (v3.4.30 => v3.4.35)
  - Updating symfony/filesystem (v3.4.30 => v3.4.35)
  - Installing symfony/polyfill-util (v1.12.0)
  - Installing symfony/polyfill-php56 (v1.12.0)
  - Updating symfony/http-foundation (v3.4.30 => v3.4.35)
  - Updating symfony/event-dispatcher (v3.4.30 => v3.4.35)
  - Updating symfony/http-kernel (v3.4.30 => v3.4.35)
  - Updating symfony/config (v3.4.30 => v3.4.35)
  - Updating symfony/dependency-injection (v3.4.30 => v3.4.35)
  - Updating symfony/class-loader (v3.4.30 => v3.4.35)
  - Updating symfony/cache (v3.4.30 => v3.4.35)
  - Updating symfony/framework-bundle (v3.4.30 => v3.4.35)
  - Updating twig/twig (v1.42.2 => v1.42.4)
  - Updating symfony/twig-bridge (v3.4.30 => v3.4.35)
  - Updating symfony/twig-bundle (v3.4.30 => v3.4.35)
  - Updating symfony/yaml (v3.4.30 => v3.4.35)
  - Updating symfony/stopwatch (v3.4.30 => v3.4.35)
  - Updating symfony/var-dumper (v3.4.30 => v3.4.35)
  - Updating symfony/web-profiler-bundle (v3.4.30 => v3.4.35)
  - Updating symfony/css-selector (v3.4.30 => v3.4.35)
This commit is contained in:
Molkobain
2019-11-18 18:04:32 +01:00
parent 532eb466a1
commit c76cccd2e7
633 changed files with 4154 additions and 4093 deletions

View File

@@ -32,7 +32,6 @@ class TemplateCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInte
* TemplateCacheWarmer constructor.
*
* @param ContainerInterface $container
* @param \Traversable $iterator
*/
public function __construct($container, \Traversable $iterator)
{

View File

@@ -49,5 +49,7 @@ class ContainerAwareRuntimeLoader implements RuntimeLoaderInterface
if (null !== $this->logger) {
$this->logger->warning(sprintf('Class "%s" is not configured as a Twig runtime. Add the "twig.runtime" tag to the related service in the container.', $class));
}
return null;
}
}

View File

@@ -18,6 +18,7 @@ use Symfony\Component\HttpKernel\Log\DebugLoggerInterface;
use Twig\Environment;
use Twig\Error\LoaderError;
use Twig\Loader\ExistsLoaderInterface;
use Twig\Loader\SourceContextLoaderInterface;
/**
* ExceptionController renders error or exception pages for a given
@@ -32,8 +33,7 @@ class ExceptionController
protected $debug;
/**
* @param Environment $twig
* @param bool $debug Show error (false) or exception (true) pages by default
* @param bool $debug Show error (false) or exception (true) pages by default
*/
public function __construct(Environment $twig, $debug)
{
@@ -88,10 +88,9 @@ class ExceptionController
}
/**
* @param Request $request
* @param string $format
* @param int $code An HTTP response status code
* @param bool $showException
* @param string $format
* @param int $code An HTTP response status code
* @param bool $showException
*
* @return string
*/
@@ -122,23 +121,28 @@ class ExceptionController
return sprintf('@Twig/Exception/%s.html.twig', $showException ? 'exception_full' : $name);
}
// to be removed when the minimum required version of Twig is >= 3.0
// to be removed when the minimum required version of Twig is >= 2.0
protected function templateExists($template)
{
$template = (string) $template;
$loader = $this->twig->getLoader();
if ($loader instanceof ExistsLoaderInterface || method_exists($loader, 'exists')) {
return $loader->exists($template);
if (1 === Environment::MAJOR_VERSION && !$loader instanceof ExistsLoaderInterface) {
try {
if ($loader instanceof SourceContextLoaderInterface) {
$loader->getSourceContext($template);
} else {
$loader->getSource($template);
}
return true;
} catch (LoaderError $e) {
}
return false;
}
try {
$loader->getSourceContext($template)->getCode();
return true;
} catch (LoaderError $e) {
}
return false;
return $loader->exists($template);
}
}

View File

@@ -150,18 +150,20 @@ class TwigExtension extends Extension
}
}
unset(
$config['form'],
$config['globals'],
$config['extensions']
);
if (isset($config['autoescape_service']) && isset($config['autoescape_service_method'])) {
$config['autoescape'] = [new Reference($config['autoescape_service']), $config['autoescape_service_method']];
}
unset($config['autoescape_service'], $config['autoescape_service_method']);
$container->getDefinition('twig')->replaceArgument(1, $config);
$container->getDefinition('twig')->replaceArgument(1, array_intersect_key($config, [
'debug' => true,
'charset' => true,
'base_template_class' => true,
'strict_variables' => true,
'autoescape' => true,
'cache' => true,
'auto_reload' => true,
'optimizations' => true,
]));
$container->registerForAutoconfiguration(\Twig_ExtensionInterface::class)->addTag('twig.extension');
$container->registerForAutoconfiguration(\Twig_LoaderInterface::class)->addTag('twig.loader');
@@ -255,9 +257,7 @@ class TwigExtension extends Extension
}
/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
* {@inheritdoc}
*/
public function getXsdValidationBasePath()
{

View File

@@ -87,11 +87,9 @@ class TwigLoaderPassTest extends TestCase
$this->assertEquals('test_loader_1', (string) $calls[1][1][0]);
}
/**
* @expectedException \Symfony\Component\DependencyInjection\Exception\LogicException
*/
public function testMapperPassWithZeroTaggedLoaders()
{
$this->expectException('Symfony\Component\DependencyInjection\Exception\LogicException');
$this->pass->process($this->builder);
}
}

View File

@@ -27,7 +27,7 @@ class NoTemplatingEntryTest extends TestCase
$container = $kernel->getContainer();
$content = $container->get('twig')->render('index.html.twig');
$this->assertContains('{ a: b }', $content);
$this->assertStringContainsString('{ a: b }', $content);
}
protected function setUp()

View File

@@ -51,11 +51,9 @@ class FilesystemLoaderTest extends TestCase
$this->assertTrue($loader->exists($template));
}
/**
* @expectedException \Twig\Error\LoaderError
*/
public function testTwigErrorIfLocatorThrowsInvalid()
{
$this->expectException('Twig\Error\LoaderError');
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
$parser
->expects($this->once())
@@ -75,11 +73,9 @@ class FilesystemLoaderTest extends TestCase
$loader->getCacheKey('name.format.engine');
}
/**
* @expectedException \Twig\Error\LoaderError
*/
public function testTwigErrorIfLocatorReturnsFalse()
{
$this->expectException('Twig\Error\LoaderError');
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
$parser
->expects($this->once())
@@ -99,12 +95,10 @@ class FilesystemLoaderTest extends TestCase
$loader->getCacheKey('name.format.engine');
}
/**
* @expectedException \Twig\Error\LoaderError
* @expectedExceptionMessageRegExp /Unable to find template "name\.format\.engine" \(looked into: .*Tests.Loader.\.\..DependencyInjection.Fixtures.Resources.views\)/
*/
public function testTwigErrorIfTemplateDoesNotExist()
{
$this->expectException('Twig\Error\LoaderError');
$this->expectExceptionMessageRegExp('/Unable to find template "name\.format\.engine" \(looked into: .*Tests.Loader.\.\..DependencyInjection.Fixtures.Resources.views\)/');
$parser = $this->getMockBuilder('Symfony\Component\Templating\TemplateNameParserInterface')->getMock();
$locator = $this->getMockBuilder('Symfony\Component\Config\FileLocatorInterface')->getMock();

View File

@@ -13,7 +13,6 @@ namespace Symfony\Bundle\TwigBundle;
use Symfony\Bridge\Twig\TwigEngine as BaseEngine;
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface;
use Symfony\Bundle\FrameworkBundle\Templating\TemplateReference;
use Symfony\Component\Config\FileLocatorInterface;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Templating\TemplateNameParserInterface;
@@ -36,28 +35,6 @@ class TwigEngine extends BaseEngine implements EngineInterface
$this->locator = $locator;
}
/**
* {@inheritdoc}
*/
public function render($name, array $parameters = [])
{
try {
return parent::render($name, $parameters);
} catch (Error $e) {
if ($name instanceof TemplateReference && !method_exists($e, 'setSourceContext')) {
try {
// try to get the real name of the template where the error occurred
$name = $e->getTemplateName();
$path = (string) $this->locator->locate($this->parser->parse($name));
$e->setTemplateName($path);
} catch (\Exception $e2) {
}
}
throw $e;
}
}
/**
* {@inheritdoc}
*

View File

@@ -23,7 +23,7 @@
"symfony/http-foundation": "~2.8|~3.0|~4.0",
"symfony/http-kernel": "^3.3|~4.0",
"symfony/polyfill-ctype": "~1.8",
"twig/twig": "~1.40|~2.9"
"twig/twig": "~1.41|~2.10"
},
"require-dev": {
"symfony/asset": "~2.8|~3.0|~4.0",
@@ -37,7 +37,7 @@
"symfony/yaml": "~2.8|~3.0|~4.0",
"symfony/framework-bundle": "^3.3.11|~4.0",
"symfony/web-link": "~3.3|~4.0",
"doctrine/annotations": "~1.0",
"doctrine/annotations": "~1.7",
"doctrine/cache": "~1.0"
},
"conflict": {