From 429307d7cfa9465b60c4a72b8a0e67ec49db21fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Thu, 16 May 2019 11:29:22 +0200 Subject: [PATCH 01/13] [Monolog] Setup the LoggerProcessor after all other processor --- src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php index 97b4ef28a6..e5c714965c 100644 --- a/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php +++ b/src/Symfony/Bundle/FrameworkBundle/FrameworkBundle.php @@ -132,7 +132,7 @@ class FrameworkBundle extends Bundle $container->addCompilerPass(new RegisterReverseContainerPass(false), PassConfig::TYPE_AFTER_REMOVING); if ($container->getParameter('kernel.debug')) { - $container->addCompilerPass(new AddDebugLogProcessorPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, -32); + $container->addCompilerPass(new AddDebugLogProcessorPass(), PassConfig::TYPE_BEFORE_OPTIMIZATION, 2); $container->addCompilerPass(new UnusedTagsPass(), PassConfig::TYPE_AFTER_REMOVING); $container->addCompilerPass(new ContainerBuilderDebugDumpPass(), PassConfig::TYPE_BEFORE_REMOVING, -255); $container->addCompilerPass(new CacheCollectorPass(), PassConfig::TYPE_BEFORE_REMOVING); From d4a9e7e6395119f815dcb25e429bb21d619acc0e Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Fri, 31 May 2019 10:49:44 +0200 Subject: [PATCH 02/13] [TwigBridge] suggest Translation Component when TranslationExtension is used --- .../Twig/Extension/TranslationExtension.php | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php index 46fdd9e7b7..9e927ecdf0 100644 --- a/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php +++ b/src/Symfony/Bridge/Twig/Extension/TranslationExtension.php @@ -49,11 +49,19 @@ class TranslationExtension extends AbstractExtension } /** - * @deprecated since Symfony 4.2 + * @return TranslatorInterface|null */ public function getTranslator() { - @trigger_error(sprintf('The "%s()" method is deprecated since Symfony 4.2.', __METHOD__), E_USER_DEPRECATED); + if (null === $this->translator) { + if (!interface_exists(TranslatorInterface::class)) { + throw new \LogicException(sprintf('You cannot use the "%s" if the Translation Contracts are not available. Try running "composer require symfony/translation".', __CLASS__)); + } + + $this->translator = new class() implements TranslatorInterface { + use TranslatorTrait; + }; + } return $this->translator; } @@ -108,13 +116,8 @@ class TranslationExtension extends AbstractExtension if (null !== $count) { $arguments['%count%'] = $count; } - if (null === $this->translator) { - $this->translator = new class() implements TranslatorInterface { - use TranslatorTrait; - }; - } - return $this->translator->trans($message, $arguments, $domain, $locale); + return $this->getTranslator()->trans($message, $arguments, $domain, $locale); } /** @@ -122,17 +125,13 @@ class TranslationExtension extends AbstractExtension */ public function transchoice($message, $count, array $arguments = [], $domain = null, $locale = null) { - if (null === $this->translator) { - $this->translator = new class() implements TranslatorInterface { - use TranslatorTrait; - }; + $translator = $this->getTranslator(); + + if ($translator instanceof TranslatorInterface) { + return $translator->trans($message, array_merge(['%count%' => $count], $arguments), $domain, $locale); } - if ($this->translator instanceof TranslatorInterface) { - return $this->translator->trans($message, array_merge(['%count%' => $count], $arguments), $domain, $locale); - } - - return $this->translator->transChoice($message, $count, array_merge(['%count%' => $count], $arguments), $domain, $locale); + return $translator->transChoice($message, $count, array_merge(['%count%' => $count], $arguments), $domain, $locale); } /** From e2c9701e222c0ac230a8f4b3d7b2ac605f0e4c05 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sat, 1 Jun 2019 14:17:19 +0200 Subject: [PATCH 03/13] [Security][Guard] Forbid security-http >= 5.0 --- src/Symfony/Component/Security/Guard/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Security/Guard/composer.json b/src/Symfony/Component/Security/Guard/composer.json index ad3343b45d..af3ce94a9b 100644 --- a/src/Symfony/Component/Security/Guard/composer.json +++ b/src/Symfony/Component/Security/Guard/composer.json @@ -18,7 +18,7 @@ "require": { "php": "^7.1.3", "symfony/security-core": "^3.4.22|^4.2.3|^5.0", - "symfony/security-http": "^4.3|^5.0" + "symfony/security-http": "^4.3" }, "require-dev": { "psr/log": "~1.0" From d7753035f86e9dcc16fa5f2320c9ba7be90e8849 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sat, 1 Jun 2019 14:48:35 +0200 Subject: [PATCH 04/13] [SecurityBundled] Forbid security-http >= 5.0 --- src/Symfony/Bundle/SecurityBundle/composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/SecurityBundle/composer.json b/src/Symfony/Bundle/SecurityBundle/composer.json index 12ce736597..5da4fd4654 100644 --- a/src/Symfony/Bundle/SecurityBundle/composer.json +++ b/src/Symfony/Bundle/SecurityBundle/composer.json @@ -24,7 +24,7 @@ "symfony/security-core": "^4.3", "symfony/security-csrf": "^4.2|^5.0", "symfony/security-guard": "^4.2|^5.0", - "symfony/security-http": "^4.3|^5.0" + "symfony/security-http": "^4.3" }, "require-dev": { "symfony/asset": "^3.4|^4.0|^5.0", From 14093386e6e28fb399e53ef4d9392a4fa04d4cfd Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Sat, 1 Jun 2019 14:56:25 +0200 Subject: [PATCH 05/13] [Messenger] Deprecate passing a bus locator to ConsumeMessagesCommand constructor --- UPGRADE-4.4.md | 12 +++++++++--- UPGRADE-5.0.md | 2 ++ src/Symfony/Component/Messenger/CHANGELOG.md | 6 ++++++ .../Messenger/Command/ConsumeMessagesCommand.php | 2 +- .../Tests/Command/ConsumeMessagesCommandTest.php | 10 +++++++++- 5 files changed, 27 insertions(+), 5 deletions(-) diff --git a/UPGRADE-4.4.md b/UPGRADE-4.4.md index e9cee836e7..0e044861bd 100644 --- a/UPGRADE-4.4.md +++ b/UPGRADE-4.4.md @@ -4,7 +4,7 @@ UPGRADE FROM 4.3 to 4.4 HttpKernel ---------- -* The `DebugHandlersListener` class has been marked as `final` + * The `DebugHandlersListener` class has been marked as `final` DependencyInjection ------------------- @@ -25,13 +25,19 @@ DependencyInjection factory: ['@factory_service', method] ``` +Messenger +--------- + + * Deprecated passing a `ContainerInterface` instance as first argument of the `ConsumeMessagesCommand` constructor, + pass a `RoutableMessageBus` instance instead. + MonologBridge -------------- -* The `RouteProcessor` has been marked final. + * The `RouteProcessor` has been marked final. TwigBridge ---------- * Deprecated to pass `$rootDir` and `$fileLinkFormatter` as 5th and 6th argument respectively to the - `DebugCommand::__construct()` method, swap the variables position. \ No newline at end of file + `DebugCommand::__construct()` method, swap the variables position. diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index 49ccf3aa0b..289910e8c2 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -269,6 +269,8 @@ Messenger --------- * The `LoggingMiddleware` class has been removed, pass a logger to `SendMessageMiddleware` instead. + * Passing a `ContainerInterface` instance as first argument of the `ConsumeMessagesCommand` constructor now + throws as `\TypeError`, pass a `RoutableMessageBus` instance instead. Monolog ------- diff --git a/src/Symfony/Component/Messenger/CHANGELOG.md b/src/Symfony/Component/Messenger/CHANGELOG.md index 49d04feb1f..fc01fa52cc 100644 --- a/src/Symfony/Component/Messenger/CHANGELOG.md +++ b/src/Symfony/Component/Messenger/CHANGELOG.md @@ -1,6 +1,12 @@ CHANGELOG ========= +4.4.0 +----- + + * Deprecated passing a `ContainerInterface` instance as first argument of the `ConsumeMessagesCommand` constructor, + pass a `RoutableMessageBus` instance instead. + 4.3.0 ----- diff --git a/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php b/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php index be6f4c1733..816cd30c35 100644 --- a/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php +++ b/src/Symfony/Component/Messenger/Command/ConsumeMessagesCommand.php @@ -54,8 +54,8 @@ class ConsumeMessagesCommand extends Command */ public function __construct($routableBus, ContainerInterface $receiverLocator, LoggerInterface $logger = null, array $receiverNames = [], /* ContainerInterface */ $retryStrategyLocator = null, EventDispatcherInterface $eventDispatcher = null) { - // to be deprecated in 4.4 if ($routableBus instanceof ContainerInterface) { + @trigger_error(sprintf('Passing a "%s" instance as first argument to "%s()" is deprecated since Symfony 4.4, pass a "%s" instance instead.', ContainerInterface::class, __METHOD__, RoutableMessageBus::class), E_USER_DEPRECATED); $routableBus = new RoutableMessageBus($routableBus); } diff --git a/src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php b/src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php index 3191c65b64..c7ae75cc1b 100644 --- a/src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php +++ b/src/Symfony/Component/Messenger/Tests/Command/ConsumeMessagesCommandTest.php @@ -27,7 +27,7 @@ class ConsumeMessagesCommandTest extends TestCase { public function testConfigurationWithDefaultReceiver() { - $command = new ConsumeMessagesCommand($this->createMock(ServiceLocator::class), $this->createMock(ServiceLocator::class), null, ['amqp']); + $command = new ConsumeMessagesCommand($this->createMock(RoutableMessageBus::class), $this->createMock(ServiceLocator::class), null, ['amqp']); $inputArgument = $command->getDefinition()->getArgument('receivers'); $this->assertFalse($inputArgument->isRequired()); $this->assertSame(['amqp'], $inputArgument->getDefault()); @@ -98,6 +98,10 @@ class ConsumeMessagesCommandTest extends TestCase $this->assertContains('[OK] Consuming messages from transports "dummy-receiver"', $tester->getDisplay()); } + /** + * @group legacy + * @expectedDeprecation Passing a "Psr\Container\ContainerInterface" instance as first argument to "Symfony\Component\Messenger\Command\ConsumeMessagesCommand::__construct()" is deprecated since Symfony 4.4, pass a "Symfony\Component\Messenger\RoutableMessageBus" instance instead. + */ public function testBasicRunWithBusLocator() { $envelope = new Envelope(new \stdClass(), [new BusNameStamp('dummy-bus')]); @@ -130,6 +134,10 @@ class ConsumeMessagesCommandTest extends TestCase $this->assertContains('[OK] Consuming messages from transports "dummy-receiver"', $tester->getDisplay()); } + /** + * @group legacy + * @expectedDeprecation Passing a "Psr\Container\ContainerInterface" instance as first argument to "Symfony\Component\Messenger\Command\ConsumeMessagesCommand::__construct()" is deprecated since Symfony 4.4, pass a "Symfony\Component\Messenger\RoutableMessageBus" instance instead. + */ public function testRunWithBusOptionAndBusLocator() { $envelope = new Envelope(new \stdClass()); From e83886c81193bf259768a509ebb94bfbc2bac70e Mon Sep 17 00:00:00 2001 From: Toni Peric Date: Sat, 1 Jun 2019 15:18:31 +0200 Subject: [PATCH 06/13] Add missing translations --- .../Resources/translations/validators.hr.xlf | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf index 60f02435f5..ccc0c0135a 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.hr.xlf @@ -334,6 +334,34 @@ This value should be valid JSON. Ova vrijednost treba biti validan JSON. + + This collection should contain only unique elements. + Ova kolekcija treba sadržavati samo unikatne elemente. + + + This value should be positive. + Ova vrijednost treba biti pozitivna. + + + This value should be either positive or zero. + Ova vrijednost treba biti pozitivna ili jednaka nuli. + + + This value should be negative. + Ova vrijednost treba biti negativna. + + + This value should be either negative or zero. + Ova vrijednost treba biti negativna ili jednaka nuli. + + + This value is not a valid timezone. + Ova vrijednost nije validna vremenska zona. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Ova lozinka je procurila u nekom od sigurnosnih propusta, te je potrebno koristiti drugu lozinku. + From 2b95fcaa6b308342a98f7dbd1e7ddf581d40fdb5 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Mon, 3 Jun 2019 10:51:36 +0200 Subject: [PATCH 07/13] update italian validator translation --- .../Resources/translations/validators.it.xlf | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf index 235d44d1bb..ca0b177586 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf @@ -330,6 +330,38 @@ This Business Identifier Code (BIC) is not associated with IBAN {{ iban }}. Questo codice identificativo bancario (BIC) non è associato all'IBAN {{ iban }}. + + This value should be valid JSON. + Questo valore dovrebbe essere un JSON valido. + + + This collection should contain only unique elements. + Questa collezione dovrebbe contenere solo elementi unici. + + + This value should be positive. + Questo valore dovrebbe essere positivo. + + + This value should be either positive or zero. + Questo valore dovrebbe essere positivo oppure zero. + + + This value should be negative. + Questo valore dovrebbe essere negativo. + + + This value should be either negative or zero. + Questo valore dovrebbe essere negativo oppure zero. + + + This value is not a valid timezone. + Questo valore non è un fuso orario valido. + + + This password has been leaked in a data breach, it must not be used. Please use another password. + Questa password è trapelata durante una compromissione di dati, non deve essere usata. Si prega di usre una password diversa. + From b37c1a818f8cea12ff8c91b9a41626ad678b7b06 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Mon, 3 Jun 2019 11:50:31 +0200 Subject: [PATCH 08/13] fix typo in PR #31802 --- .../Validator/Resources/translations/validators.it.xlf | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf b/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf index ca0b177586..f4c188d1dd 100644 --- a/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf +++ b/src/Symfony/Component/Validator/Resources/translations/validators.it.xlf @@ -360,7 +360,7 @@ This password has been leaked in a data breach, it must not be used. Please use another password. - Questa password è trapelata durante una compromissione di dati, non deve essere usata. Si prega di usre una password diversa. + Questa password è trapelata durante una compromissione di dati, non deve essere usata. Si prega di usare una password diversa. From 5c394eeb79e45206f8f86e5a379e2fa2b7a952db Mon Sep 17 00:00:00 2001 From: Pierre du Plessis Date: Mon, 3 Jun 2019 16:14:28 +0200 Subject: [PATCH 09/13] Collect locale details earlier in the process in TranslationDataCollector --- .../Translation/DataCollector/TranslationDataCollector.php | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php b/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php index d99b493ac6..35dfc0e344 100644 --- a/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php +++ b/src/Symfony/Component/Translation/DataCollector/TranslationDataCollector.php @@ -36,12 +36,9 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto { $messages = $this->sanitizeCollectedMessages($this->translator->getCollectedMessages()); - $this->data = $this->computeCount($messages); + $this->data += $this->computeCount($messages); $this->data['messages'] = $messages; - $this->data['locale'] = $this->translator->getLocale(); - $this->data['fallback_locales'] = $this->translator->getFallbackLocales(); - $this->data = $this->cloneVar($this->data); } @@ -50,6 +47,8 @@ class TranslationDataCollector extends DataCollector implements LateDataCollecto */ public function collect(Request $request, Response $response, \Exception $exception = null) { + $this->data['locale'] = $this->translator->getLocale(); + $this->data['fallback_locales'] = $this->translator->getFallbackLocales(); } /** From 648c6949fc1360247a86418317f38f77fb303de5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Pineau?= Date: Mon, 3 Jun 2019 17:30:31 +0200 Subject: [PATCH 10/13] Simplify code - catch \Throwable capture all exceptions This is a legacy when we did support PHP 5.X --- src/Symfony/Component/Filesystem/Filesystem.php | 1 - src/Symfony/Component/HttpKernel/Kernel.php | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/Symfony/Component/Filesystem/Filesystem.php b/src/Symfony/Component/Filesystem/Filesystem.php index 082084b4d9..9ec1e94354 100644 --- a/src/Symfony/Component/Filesystem/Filesystem.php +++ b/src/Symfony/Component/Filesystem/Filesystem.php @@ -750,7 +750,6 @@ class Filesystem return $result; } catch (\Throwable $e) { - } catch (\Exception $e) { } \restore_error_handler(); diff --git a/src/Symfony/Component/HttpKernel/Kernel.php b/src/Symfony/Component/HttpKernel/Kernel.php index 14257d0f60..4e316cdfdc 100644 --- a/src/Symfony/Component/HttpKernel/Kernel.php +++ b/src/Symfony/Component/HttpKernel/Kernel.php @@ -487,7 +487,6 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl $fresh = true; } } catch (\Throwable $e) { - } catch (\Exception $e) { } finally { error_reporting($errorLevel); } @@ -556,7 +555,6 @@ abstract class Kernel implements KernelInterface, RebootableInterface, Terminabl try { $oldContainer = include $cache->getPath(); } catch (\Throwable $e) { - } catch (\Exception $e) { } finally { error_reporting($errorLevel); } From 61613d0bf0b05ada206e3da3f05ba2703fc83f14 Mon Sep 17 00:00:00 2001 From: Yonel Ceruto Date: Mon, 3 Jun 2019 10:56:39 -0400 Subject: [PATCH 11/13] Add missing deprecations for PHP templating layer --- UPGRADE-4.4.md | 5 +++++ UPGRADE-5.0.md | 1 + src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md | 5 +++++ .../Bundle/FrameworkBundle/Controller/TemplateController.php | 4 ++++ .../Tests/Controller/TemplateControllerTest.php | 3 +++ .../TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php | 4 ++++ .../DependencyInjection/Compiler/ExtensionPass.php | 1 + .../Bundle/TwigBundle/Resources/config/templating.xml | 2 ++ src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml | 2 ++ .../HttpKernel/Fragment/HIncludeFragmentRenderer.php | 2 ++ 10 files changed, 29 insertions(+) diff --git a/UPGRADE-4.4.md b/UPGRADE-4.4.md index 0e044861bd..73d80523a2 100644 --- a/UPGRADE-4.4.md +++ b/UPGRADE-4.4.md @@ -31,6 +31,11 @@ Messenger * Deprecated passing a `ContainerInterface` instance as first argument of the `ConsumeMessagesCommand` constructor, pass a `RoutableMessageBus` instance instead. +FrameworkBundle +--------------- + + * Deprecated support for `templating` engine in `TemplateController`, use Twig instead + MonologBridge -------------- diff --git a/UPGRADE-5.0.md b/UPGRADE-5.0.md index 289910e8c2..1f1bd58ff5 100644 --- a/UPGRADE-5.0.md +++ b/UPGRADE-5.0.md @@ -219,6 +219,7 @@ FrameworkBundle * Removed support for legacy translations directories `src/Resources/translations/` and `src/Resources//translations/`, use `translations/` instead. * Support for the legacy directory structure in `translation:update` and `debug:translation` commands has been removed. * Removed the "Psr\SimpleCache\CacheInterface" / "cache.app.simple" service, use "Symfony\Contracts\Cache\CacheInterface" / "cache.app" instead. + * Removed support for `templating` engine in `TemplateController`, use Twig instead HttpFoundation -------------- diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index d32da9541a..4b1932e3a4 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -1,6 +1,11 @@ CHANGELOG ========= +4.4.0 +----- + + * Deprecated support for `templating` engine in `TemplateController`, use Twig instead + 4.3.0 ----- diff --git a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php index 211c7ce6c8..8e359569f8 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php +++ b/src/Symfony/Bundle/FrameworkBundle/Controller/TemplateController.php @@ -29,6 +29,10 @@ class TemplateController public function __construct(Environment $twig = null, EngineInterface $templating = null) { + if (null !== $templating) { + @trigger_error(sprintf('Using a "%s" instance for "%s" is deprecated since version 4.4; use a \Twig\Environment instance instead.', EngineInterface::class, __CLASS__), E_USER_DEPRECATED); + } + $this->twig = $twig; $this->templating = $templating; } diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php index a3abae0298..a19d0651bb 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/Controller/TemplateControllerTest.php @@ -31,6 +31,9 @@ class TemplateControllerTest extends TestCase $this->assertEquals('bar', $controller('mytemplate')->getContent()); } + /** + * @group legacy + */ public function testTemplating() { $templating = $this->getMockBuilder(EngineInterface::class)->getMock(); diff --git a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php index f74b1c5325..4905bd3b1e 100644 --- a/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php +++ b/src/Symfony/Bundle/TwigBundle/CacheWarmer/TemplateCacheCacheWarmer.php @@ -11,6 +11,8 @@ namespace Symfony\Bundle\TwigBundle\CacheWarmer; +@trigger_error('The '.TemplateCacheCacheWarmer::class.' class is deprecated since version 4.4 and will be removed in 5.0; use Twig instead.', E_USER_DEPRECATED); + use Psr\Container\ContainerInterface; use Symfony\Bundle\FrameworkBundle\CacheWarmer\TemplateFinderInterface; use Symfony\Component\DependencyInjection\ServiceSubscriberInterface; @@ -26,6 +28,8 @@ use Twig\Error\Error; * as the Twig loader will need the cache generated by it. * * @author Fabien Potencier + * + * @deprecated since version 4.4, to be removed in 5.0; use Twig instead. */ class TemplateCacheCacheWarmer implements CacheWarmerInterface, ServiceSubscriberInterface { diff --git a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php index 79a6ad9ae8..ba7e782378 100644 --- a/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php +++ b/src/Symfony/Bundle/TwigBundle/DependencyInjection/Compiler/ExtensionPass.php @@ -105,6 +105,7 @@ class ExtensionPass implements CompilerPassInterface } else { $container->setAlias('twig.loader.filesystem', new Alias('twig.loader.native_filesystem', false)); $container->removeDefinition('templating.engine.twig'); + $container->removeDefinition('twig.cache_warmer'); } if ($container->has('assets.packages')) { diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml index 1eba213f0e..6768328f46 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/templating.xml @@ -17,6 +17,8 @@ + + The "%service_id%" service is deprecated since Symfony 4.4 and will be removed in 5.0. diff --git a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml index 13121a2a18..684a688731 100644 --- a/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml +++ b/src/Symfony/Bundle/TwigBundle/Resources/config/twig.xml @@ -35,6 +35,8 @@ + + The "%service_id%" service is deprecated since Symfony 4.4 and will be removed in 5.0. diff --git a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php index 9a700a9b11..08f7c167d5 100644 --- a/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php +++ b/src/Symfony/Component/HttpKernel/Fragment/HIncludeFragmentRenderer.php @@ -52,6 +52,8 @@ class HIncludeFragmentRenderer extends RoutableFragmentRenderer * @param EngineInterface|Environment|null $templating An EngineInterface or an Environment instance * * @throws \InvalidArgumentException + * + * @internal */ public function setTemplating($templating) { From 0e741f960064e12e3383098b80294864a8f359b6 Mon Sep 17 00:00:00 2001 From: Massimiliano Arione Date: Mon, 3 Jun 2019 15:30:08 +0200 Subject: [PATCH 12/13] fix type hint for salt in PasswordEncoderInterface --- .../Security/Core/Encoder/BasePasswordEncoder.php | 4 ++-- .../Security/Core/Encoder/PasswordEncoderInterface.php | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php b/src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php index 3c3ea1aa17..3a5c4f0c4b 100644 --- a/src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php +++ b/src/Symfony/Component/Security/Core/Encoder/BasePasswordEncoder.php @@ -48,8 +48,8 @@ abstract class BasePasswordEncoder implements PasswordEncoderInterface /** * Merges a password and a salt. * - * @param string $password The password to be used - * @param string $salt The salt to be used + * @param string $password The password to be used + * @param string|null $salt The salt to be used * * @return string a merged password and salt * diff --git a/src/Symfony/Component/Security/Core/Encoder/PasswordEncoderInterface.php b/src/Symfony/Component/Security/Core/Encoder/PasswordEncoderInterface.php index e0573051eb..03cdaca44a 100644 --- a/src/Symfony/Component/Security/Core/Encoder/PasswordEncoderInterface.php +++ b/src/Symfony/Component/Security/Core/Encoder/PasswordEncoderInterface.php @@ -23,8 +23,8 @@ interface PasswordEncoderInterface /** * Encodes the raw password. * - * @param string $raw The password to encode - * @param string $salt The salt + * @param string $raw The password to encode + * @param string|null $salt The salt * * @return string The encoded password * @@ -36,9 +36,9 @@ interface PasswordEncoderInterface /** * Checks a raw password against an encoded password. * - * @param string $encoded An encoded password - * @param string $raw A raw password - * @param string $salt The salt + * @param string $encoded An encoded password + * @param string $raw A raw password + * @param string|null $salt The salt * * @return bool true if the password is valid, false otherwise * From ec690b214580c2974183563a56727bc82d68f200 Mon Sep 17 00:00:00 2001 From: Javier Eguiluz Date: Sat, 1 Jun 2019 15:16:50 +0200 Subject: [PATCH 13/13] [Translation] Fixed case sensitivity of lint:xliff command --- .../Translation/Command/XliffLintCommand.php | 4 +++- .../Tests/Command/XliffLintCommandTest.php | 11 +++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/Translation/Command/XliffLintCommand.php b/src/Symfony/Component/Translation/Command/XliffLintCommand.php index 9bea4d9499..3c2cc9efde 100644 --- a/src/Symfony/Component/Translation/Command/XliffLintCommand.php +++ b/src/Symfony/Component/Translation/Command/XliffLintCommand.php @@ -124,7 +124,9 @@ EOF $normalizedLocale = preg_quote(str_replace('-', '_', $targetLanguage), '/'); // strict file names require translation files to be named '____.locale.xlf' // otherwise, both '____.locale.xlf' and 'locale.____.xlf' are allowed - $expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.%s\.xlf/', $normalizedLocale) : sprintf('/^(.*\.%s\.xlf|%s\..*\.xlf)/', $normalizedLocale, $normalizedLocale); + // also, the regexp matching must be case-insensitive, as defined for 'target-language' values + // http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html#target-language + $expectedFilenamePattern = $this->requireStrictFileNames ? sprintf('/^.*\.(?i:%s)\.xlf/', $normalizedLocale) : sprintf('/^(.*\.(?i:%s)\.xlf|(?i:%s)\..*\.xlf)/', $normalizedLocale, $normalizedLocale); if (0 === preg_match($expectedFilenamePattern, basename($file))) { $errors[] = [ diff --git a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php index 516d98af53..df2e2f0951 100644 --- a/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php +++ b/src/Symfony/Component/Translation/Tests/Command/XliffLintCommandTest.php @@ -94,6 +94,17 @@ class XliffLintCommandTest extends TestCase $this->assertContains('There is a mismatch between the language included in the file name ("messages.en.xlf") and the "es" value used in the "target-language" attribute of the file.', trim($tester->getDisplay())); } + public function testLintTargetLanguageIsCaseInsensitive() + { + $tester = $this->createCommandTester(); + $filename = $this->createFile('note', 'zh-cn', 'messages.zh_CN.xlf'); + + $tester->execute(['filename' => $filename], ['decorated' => false]); + + $this->assertEquals(0, $tester->getStatusCode()); + $this->assertContains('[OK] All 1 XLIFF files contain valid syntax.', trim($tester->getDisplay())); + } + /** * @expectedException \RuntimeException */