From 50ef4f00538e47cc1adf83f5b39628c7b54cef58 Mon Sep 17 00:00:00 2001 From: Robin Chalas Date: Tue, 19 Oct 2021 12:25:23 +0200 Subject: [PATCH] Remove remaining deprecated features --- src/Symfony/Bridge/Monolog/CHANGELOG.md | 1 + .../Monolog/Handler/SwiftMailerHandler.php | 97 ------------------- .../Bundle/FrameworkBundle/CHANGELOG.md | 1 + .../DependencyInjection/Configuration.php | 6 -- .../FrameworkExtension.php | 13 +-- .../Resources/config/schema/symfony-1.0.xsd | 1 - .../yml/legacy_translator_enabled_locales.yml | 14 --- .../FrameworkExtensionTest.php | 16 --- .../Bundle/SecurityBundle/CHANGELOG.md | 1 + .../Security/FirewallConfig.php | 10 -- 10 files changed, 6 insertions(+), 154 deletions(-) delete mode 100644 src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php delete mode 100644 src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/legacy_translator_enabled_locales.yml diff --git a/src/Symfony/Bridge/Monolog/CHANGELOG.md b/src/Symfony/Bridge/Monolog/CHANGELOG.md index a44d94ea862ab..14c0e5882d015 100644 --- a/src/Symfony/Bridge/Monolog/CHANGELOG.md +++ b/src/Symfony/Bridge/Monolog/CHANGELOG.md @@ -7,6 +7,7 @@ CHANGELOG * The `$actionLevel` constructor argument of `NotFoundActivationStrategy` has been replaced by the `$inner` one which expects an `ActivationStrategyInterface` to decorate instead * The `$actionLevel` constructor argument of `HttpCodeActivationStrategy` has been replaced by the `$inner` one which expects an `ActivationStrategyInterface` to decorate instead * Remove `ResetLoggersWorkerSubscriber` in favor of "reset_on_message" option in messenger configuration + * Remove `SwiftMailerHandler`, use `MailerHandler` instead 5.4 --- diff --git a/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php b/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php deleted file mode 100644 index c0e678f30c783..0000000000000 --- a/src/Symfony/Bridge/Monolog/Handler/SwiftMailerHandler.php +++ /dev/null @@ -1,97 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE - * file that was distributed with this source code. - */ - -namespace Symfony\Bridge\Monolog\Handler; - -use Monolog\Handler\SwiftMailerHandler as BaseSwiftMailerHandler; -use Symfony\Component\Console\Event\ConsoleTerminateEvent; -use Symfony\Component\HttpKernel\Event\TerminateEvent; - -trigger_deprecation('symfony/monolog-bridge', '5.4', '"%s" is deprecated and will be removed in 6.0.', SwiftMailerHandler::class); - -/** - * Extended SwiftMailerHandler that flushes mail queue if necessary. - * - * @author Philipp Kräutli - * - * @final - * - * @deprecated since Symfony 5.4 - */ -class SwiftMailerHandler extends BaseSwiftMailerHandler -{ - protected $transport; - - protected $instantFlush = false; - - public function setTransport(\Swift_Transport $transport) - { - $this->transport = $transport; - } - - /** - * After the kernel has been terminated we will always flush messages. - */ - public function onKernelTerminate(TerminateEvent $event) - { - $this->instantFlush = true; - } - - /** - * After the CLI application has been terminated we will always flush messages. - */ - public function onCliTerminate(ConsoleTerminateEvent $event) - { - $this->instantFlush = true; - } - - /** - * {@inheritdoc} - */ - protected function send($content, array $records): void - { - parent::send($content, $records); - - if ($this->instantFlush) { - $this->flushMemorySpool(); - } - } - - /** - * {@inheritdoc} - */ - public function reset(): void - { - $this->flushMemorySpool(); - } - - /** - * Flushes the mail queue if a memory spool is used. - */ - private function flushMemorySpool() - { - $mailerTransport = $this->mailer->getTransport(); - if (!$mailerTransport instanceof \Swift_Transport_SpoolTransport) { - return; - } - - $spool = $mailerTransport->getSpool(); - if (!$spool instanceof \Swift_MemorySpool) { - return; - } - - if (null === $this->transport) { - throw new \Exception('No transport available to flush mail queue.'); - } - - $spool->flushQueue($this->transport); - } -} diff --git a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md index e2857701e0464..a577d9c958793 100644 --- a/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/FrameworkBundle/CHANGELOG.md @@ -20,6 +20,7 @@ CHANGELOG * Register workflow services as private * Remove support for passing a `RouteCollectionBuilder` to `MicroKernelTrait::configureRoutes()`, type-hint `RoutingConfigurator` instead * Remove the `cache.adapter.doctrine` service + * Remove the `framework.translator.enabled_locales` config option, use `framework.enabled_locales` instead 5.4 --- diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php index 95fea18b4a4a1..10577d3e4379e 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php @@ -785,7 +785,6 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e ->{$enableIfStandalone('symfony/translation', Translator::class)}() ->fixXmlConfig('fallback') ->fixXmlConfig('path') - ->fixXmlConfig('enabled_locale') ->fixXmlConfig('provider') ->children() ->arrayNode('fallbacks') @@ -804,11 +803,6 @@ private function addTranslatorSection(ArrayNodeDefinition $rootNode, callable $e ->arrayNode('paths') ->prototype('scalar')->end() ->end() - ->arrayNode('enabled_locales') - ->setDeprecated('symfony/framework-bundle', '5.3', 'Option "%node%" at "%path%" is deprecated, set the "framework.enabled_locales" option instead.') - ->prototype('scalar')->end() - ->defaultValue([]) - ->end() ->arrayNode('pseudo_localization') ->canBeEnabled() ->fixXmlConfig('localizable_html_attribute') diff --git a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php index 5f49504005438..98b2b4f9717dc 100644 --- a/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php +++ b/src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php @@ -426,9 +426,7 @@ public function load(array $configs, ContainerBuilder $container) $this->registerProfilerConfiguration($config['profiler'], $container, $loader); $this->registerWorkflowConfiguration($config['workflows'], $container, $loader); $this->registerDebugConfiguration($config['php_errors'], $container, $loader); - // @deprecated since Symfony 5.4, in 6.0 change to: - // $this->registerRouterConfiguration($config['router'], $container, $loader, $config['enabled_locales']); - $this->registerRouterConfiguration($config['router'], $container, $loader, $config['translator']['enabled_locales'] ?: $config['enabled_locales']); + $this->registerRouterConfiguration($config['router'], $container, $loader, $config['enabled_locales']); $this->registerAnnotationsConfiguration($config['annotations'], $container, $loader); $this->registerPropertyAccessConfiguration($config['property_access'], $container, $loader); $this->registerSecretsConfiguration($config['secrets'], $container, $loader); @@ -1217,10 +1215,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder $defaultOptions = $translator->getArgument(4); $defaultOptions['cache_dir'] = $config['cache_dir']; $translator->setArgument(4, $defaultOptions); - - // @deprecated since Symfony 5.4, in 6.0 change to: - // $translator->setArgument(5, $enabledLocales); - $translator->setArgument(5, $config['enabled_locales'] ?: $enabledLocales); + $translator->setArgument(5, $enabledLocales); $container->setParameter('translator.logging', $config['logging']); $container->setParameter('translator.default_path', $config['default_path']); @@ -1353,9 +1348,7 @@ private function registerTranslatorConfiguration(array $config, ContainerBuilder return; } - // @deprecated since Symfony 5.4, in 6.0 change to: - // $locales = $enabledLocales; - $locales = $config['enabled_locales'] ?: $enabledLocales; + $locales = $enabledLocales; foreach ($config['providers'] as $provider) { if ($provider['locales']) { diff --git a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd index 63b598ed18c3e..5ed4423cd3c87 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd +++ b/src/Symfony/Bundle/FrameworkBundle/Resources/config/schema/symfony-1.0.xsd @@ -180,7 +180,6 @@ - diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/legacy_translator_enabled_locales.yml b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/legacy_translator_enabled_locales.yml deleted file mode 100644 index fd3f574b37164..0000000000000 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/Fixtures/yml/legacy_translator_enabled_locales.yml +++ /dev/null @@ -1,14 +0,0 @@ -framework: - secret: s3cr3t - default_locale: fr - router: - resource: '%kernel.project_dir%/config/routing.xml' - type: xml - utf8: true - translator: - enabled: true - fallback: fr - default_path: '%kernel.project_dir%/translations' - cache_dir: '%kernel.cache_dir%/translations' - paths: ['%kernel.project_dir%/Fixtures/translations'] - enabled_locales: [ 'fr', 'en' ] diff --git a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php index 045b6ea5f4441..f215ce4ca27f5 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php +++ b/src/Symfony/Bundle/FrameworkBundle/Tests/DependencyInjection/FrameworkExtensionTest.php @@ -544,22 +544,6 @@ public function testRouter() $this->assertSame(['_locale' => 'fr|en'], $container->getDefinition('routing.loader')->getArgument(2)); } - /** - * @group legacy - */ - public function testRouterWithLegacyTranslatorEnabledLocales() - { - $container = $this->createContainerFromFile('legacy_translator_enabled_locales'); - - $this->assertTrue($container->has('router'), '->registerRouterConfiguration() loads routing.xml'); - $arguments = $container->findDefinition('router')->getArguments(); - $this->assertEquals($container->getParameter('kernel.project_dir').'/config/routing.xml', $container->getParameter('router.resource'), '->registerRouterConfiguration() sets routing resource'); - $this->assertEquals('%router.resource%', $arguments[1], '->registerRouterConfiguration() sets routing resource'); - $this->assertEquals('xml', $arguments[2]['resource_type'], '->registerRouterConfiguration() sets routing resource type'); - - $this->assertSame(['_locale' => 'fr|en'], $container->getDefinition('routing.loader')->getArgument(2)); - } - public function testRouterRequiresResourceOption() { $this->expectException(InvalidConfigurationException::class); diff --git a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md index 9d342cf5dc8e7..8c78285436e97 100644 --- a/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md +++ b/src/Symfony/Bundle/SecurityBundle/CHANGELOG.md @@ -12,6 +12,7 @@ CHANGELOG * Remove the `security.user_password_encoder.generic` service, the `security.password_encoder` and the `Symfony\Component\Security\Core\Encoder\UserPasswordEncoderInterface` aliases, use `security.user_password_hasher`, `security.password_hasher` and `Symfony\Component\PasswordHasher\Hasher\UserPasswordHasherInterface` instead * Remove the `logout.success_handler` and `logout.handlers` config options, register a listener on the `LogoutEvent` event instead + * Remove `FirewallConfig::getListeners()`, use `FirewallConfig::getAuthenticators()` instead 5.4 --- diff --git a/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php b/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php index d58ff4b3a6326..0ce061fae339b 100644 --- a/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php +++ b/src/Symfony/Bundle/SecurityBundle/Security/FirewallConfig.php @@ -102,16 +102,6 @@ public function getAccessDeniedUrl(): ?string return $this->accessDeniedUrl; } - /** - * @deprecated since Symfony 5.4, use {@see getListeners()} instead - */ - public function getListeners(): array - { - trigger_deprecation('symfony/security-bundle', '5.4', 'Method "%s()" is deprecated, use "%s::getAuthenticators()" instead.', __METHOD__, __CLASS__); - - return $this->getAuthenticators(); - } - public function getAuthenticators(): array { return $this->authenticators; pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy