From 72069ea85d3697eae65fddfa8dc274162ee173dd Mon Sep 17 00:00:00 2001 From: bocharsky-bw Date: Thu, 17 Jun 2021 17:32:11 +0300 Subject: [PATCH 1/5] Suppress deprecations on deprecating legacy services --- DependencyInjection/TranslationExtension.php | 5 +++ Legacy/LegacyHelper.php | 29 ++++++++++++ Resources/config/console.yaml | 17 ------- Resources/config/edit_in_place.yaml | 14 ------ Resources/config/extractors.yaml | 47 -------------------- Resources/config/legacy/console.php | 22 +++++++++ Resources/config/legacy/edit_in_place.php | 20 +++++++++ Resources/config/legacy/extractors.php | 42 +++++++++++++++++ Resources/config/legacy/services.php | 32 +++++++++++++ Resources/config/services.yaml | 40 ----------------- 10 files changed, 150 insertions(+), 118 deletions(-) create mode 100644 Resources/config/legacy/console.php create mode 100644 Resources/config/legacy/edit_in_place.php create mode 100644 Resources/config/legacy/extractors.php create mode 100644 Resources/config/legacy/services.php diff --git a/DependencyInjection/TranslationExtension.php b/DependencyInjection/TranslationExtension.php index 11ed972e..7fdb0582 100644 --- a/DependencyInjection/TranslationExtension.php +++ b/DependencyInjection/TranslationExtension.php @@ -47,9 +47,12 @@ public function load(array $configs, ContainerBuilder $container): void $configuration = new Configuration($container); $config = $this->processConfiguration($configuration, $configs); $loader = new Loader\YamlFileLoader($container, new FileLocator(__DIR__.'/../Resources/config')); + $legacyLoader = new Loader\PhpFileLoader($container, new FileLocator(__DIR__.'/../Resources/config/legacy')); $loader->load('services.yaml'); + $legacyLoader->load('services.php'); $loader->load('extractors.yaml'); + $legacyLoader->load('extractors.php'); // Add major version to extractor $container->getDefinition(FormTypeChoices::class) @@ -74,6 +77,7 @@ public function load(array $configs, ContainerBuilder $container): void if ($config['edit_in_place']['enabled']) { $loader->load('edit_in_place.yaml'); + $legacyLoader->load('edit_in_place.php'); $this->enableEditInPlace($container, $config); } @@ -89,6 +93,7 @@ public function load(array $configs, ContainerBuilder $container): void } $loader->load('console.yaml'); + $legacyLoader->load('console.php'); } /** diff --git a/Legacy/LegacyHelper.php b/Legacy/LegacyHelper.php index 1b334915..debb9c73 100644 --- a/Legacy/LegacyHelper.php +++ b/Legacy/LegacyHelper.php @@ -11,7 +11,9 @@ namespace Translation\Bundle\Legacy; +use Symfony\Component\DependencyInjection\Loader\Configurator\ServicesConfigurator; use Symfony\Component\HttpFoundation\RequestStack; +use Symfony\Component\HttpKernel\Kernel; /** * A legacy helper to suppress deprecations on RequestStack. @@ -28,4 +30,31 @@ public static function getMainRequest(RequestStack $requestStack) return $requestStack->getMasterRequest(); } + + /** + * @param ServicesConfigurator $servicesConfigurator + * @param array[string $id, string $parent, ?bool $isPublic] $legacyServices + */ + public static function deprecateServices(ServicesConfigurator $servicesConfigurator, array $legacyServices) + { + foreach ($legacyServices as $legacyService) { + $id = $legacyService[0]; + $parent = $legacyService[1]; + $isPublic = $legacyService[2] ?? false; + + # Declare legacy services to remove in next major release + $service = $servicesConfigurator->set($id) + ->parent($parent); + + if (Kernel::VERSION_ID < 501000) { + $service->deprecate('Since php-translation/symfony-bundle 0.10.0: The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.'); + } else { + $service->deprecate('php-translation/symfony-bundle', '0.10.0', 'The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.'); + } + + if ($isPublic) { + $service->public(); + } + } + } } diff --git a/Resources/config/console.yaml b/Resources/config/console.yaml index dcbf06ec..2a003472 100644 --- a/Resources/config/console.yaml +++ b/Resources/config/console.yaml @@ -65,20 +65,3 @@ services: - '@Translation\Bundle\Service\StorageManager' tags: - { name: console.command, command: translation:sync } - - # To remove in next major release - php_translator.console.delete_obsolete: - parent: Translation\Bundle\Command\DeleteObsoleteCommand - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translator.console.download: - parent: Translation\Bundle\Command\DownloadCommand - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translator.console.extract: - parent: Translation\Bundle\Command\ExtractCommand - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translator.console.status: - parent: Translation\Bundle\Command\StatusCommand - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translator.console.sync: - parent: Translation\Bundle\Command\SyncCommand - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' diff --git a/Resources/config/edit_in_place.yaml b/Resources/config/edit_in_place.yaml index f6180e55..47f4220e 100644 --- a/Resources/config/edit_in_place.yaml +++ b/Resources/config/edit_in_place.yaml @@ -36,17 +36,3 @@ services: - ~ tags: - { name: 'twig.extension' } - - # To remove in next major release - php_translation.edit_in_place.response_listener: - parent: Translation\Bundle\EventListener\EditInPlaceResponseListener - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translation.edit_in_place.activator: - parent: Translation\Bundle\EditInPlace\Activator - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translator.edit_in_place.xtrans_html_translator: - parent: Translation\Bundle\Translator\EditInPlaceTranslator - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translation.edit_in_place.extension.trans: - parent: Translation\Bundle\Twig\EditInPlaceExtension - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' diff --git a/Resources/config/extractors.yaml b/Resources/config/extractors.yaml index a692eeca..68bb9095 100644 --- a/Resources/config/extractors.yaml +++ b/Resources/config/extractors.yaml @@ -24,52 +24,5 @@ services: tags: - { name: 'php_translation.visitor', type: 'twig' } - # To remove in next major release - php_translation.extractor.php: - alias: Translation\Extractor\FileExtractor\PHPFileExtractor - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.twig: - alias: Translation\Extractor\FileExtractor\TwigFileExtractor - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.ContainerAwareTrans: - alias: Translation\Extractor\Visitor\Php\Symfony\ContainerAwareTrans - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.ContainerAwareTransChoice: - alias: Translation\Extractor\Visitor\Php\Symfony\ContainerAwareTransChoice - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.FlashMessage: - alias: Translation\Extractor\Visitor\Php\Symfony\FlashMessage - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.FormTypeChoices: - alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeChoices - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.FormTypeEmptyValue: - alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeEmptyValue - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.FormTypeHelp: - alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeHelp - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.FormTypeInvalidMessage: - alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeInvalidMessage - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.FormTypeLabelExplicit: - alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeLabelExplicit - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.FormTypeLabelImplicit: - alias: Translation\Extractor\Visitor\Php\Symfony\FormTypeLabelImplicit - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.FormTypePlaceholder: - alias: Translation\Extractor\Visitor\Php\Symfony\FormTypePlaceholder - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.ValidationAnnotation: - alias: Translation\Extractor\Visitor\Php\Symfony\ValidationAnnotation - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.php.visitor.SourceLocationContainerVisitor: - alias: Translation\Extractor\Visitor\Php\SourceLocationContainerVisitor - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - php_translation.extractor.twig.factory.twig: - alias: Translation\Extractor\Visitor\Twig\TwigVisitor - deprecated: 'The "%service_id%" service is deprecated. You should use "%alias_id%" instead, as it will be removed in the future.' - Translation\Extractor\Visitor\Php\Symfony\ValidationAnnotation: arguments: ['@validator'] diff --git a/Resources/config/legacy/console.php b/Resources/config/legacy/console.php new file mode 100644 index 00000000..993237e2 --- /dev/null +++ b/Resources/config/legacy/console.php @@ -0,0 +1,22 @@ +services(); + + LegacyHelper::deprecateServices($services, [ + ['php_translator.console.delete_obsolete', DeleteObsoleteCommand::class], + ['php_translator.console.download', DownloadCommand::class], + ['php_translator.console.extract', ExtractCommand::class], + ['php_translator.console.status', StatusCommand::class], + ['php_translator.console.sync', SyncCommand::class], + ]); +}; diff --git a/Resources/config/legacy/edit_in_place.php b/Resources/config/legacy/edit_in_place.php new file mode 100644 index 00000000..98d6d211 --- /dev/null +++ b/Resources/config/legacy/edit_in_place.php @@ -0,0 +1,20 @@ +services(); + + LegacyHelper::deprecateServices($services, [ + ['php_translation.edit_in_place.response_listener', EditInPlaceResponseListener::class], + ['php_translation.edit_in_place.activator', Activator::class], + ['php_translator.edit_in_place.xtrans_html_translator', EditInPlaceTranslator::class], + ['php_translation.edit_in_place.extension.trans', EditInPlaceExtension::class], + ]); +}; diff --git a/Resources/config/legacy/extractors.php b/Resources/config/legacy/extractors.php new file mode 100644 index 00000000..0ae8c0f4 --- /dev/null +++ b/Resources/config/legacy/extractors.php @@ -0,0 +1,42 @@ +services(); + + LegacyHelper::deprecateServices($services, [ + ['php_translation.extractor.php', PHPFileExtractor::class], + ['php_translation.extractor.twig', TwigFileExtractor::class], + ['php_translation.extractor.php.visitor.ContainerAwareTrans', ContainerAwareTrans::class], + ['php_translation.extractor.php.visitor.ContainerAwareTransChoice', ContainerAwareTransChoice::class], + ['php_translation.extractor.php.visitor.FlashMessage', FlashMessage::class], + ['php_translation.extractor.php.visitor.FormTypeChoices', FormTypeChoices::class], + ['php_translation.extractor.php.visitor.FormTypeEmptyValue', FormTypeEmptyValue::class], + ['php_translation.extractor.php.visitor.FormTypeHelp', FormTypeHelp::class], + ['php_translation.extractor.php.visitor.FormTypeInvalidMessage', FormTypeInvalidMessage::class], + ['php_translation.extractor.php.visitor.FormTypeLabelExplicit', FormTypeLabelExplicit::class], + ['php_translation.extractor.php.visitor.FormTypeLabelImplicit', FormTypeLabelImplicit::class], + ['php_translation.extractor.php.visitor.FormTypePlaceholder', FormTypePlaceholder::class], + ['php_translation.extractor.php.visitor.ValidationAnnotation', ValidationAnnotation::class], + ['php_translation.extractor.php.visitor.SourceLocationContainerVisitor', SourceLocationContainerVisitor::class], + ['php_translation.extractor.twig.factory.twig', TwigVisitor::class], + ]); +}; diff --git a/Resources/config/legacy/services.php b/Resources/config/legacy/services.php new file mode 100644 index 00000000..5d75c13e --- /dev/null +++ b/Resources/config/legacy/services.php @@ -0,0 +1,32 @@ +services(); + + LegacyHelper::deprecateServices($services, [ + ['php_translation.catalogue_fetcher', CatalogueFetcher::class, true], + ['php_translation.catalogue_writer', CatalogueWriter::class, true], + ['php_translation.catalogue_manager', CatalogueManager::class, true], + ['php_translation.extractor', Extractor::class], + ['php_translation.storage_manager', StorageManager::class, true], + ['php_translation.configuration_manager', ConfigurationManager::class, true], + ['php_translation.importer', Importer::class, true], + ['php_translation.cache_clearer', CacheClearer::class, true], + ['php_translation.catalogue_counter', CatalogueCounter::class, true], + ['php_translation.twig_extension', TranslationExtension::class], + ]); +}; diff --git a/Resources/config/services.yaml b/Resources/config/services.yaml index 23cec40c..646e1acb 100644 --- a/Resources/config/services.yaml +++ b/Resources/config/services.yaml @@ -43,43 +43,3 @@ services: arguments: ['@translator', '%kernel.debug%'] tags: - { name: twig.extension } - - # To remove in next major release - php_translation.catalogue_fetcher: - parent: Translation\Bundle\Catalogue\CatalogueFetcher - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - public: true - php_translation.catalogue_writer: - parent: Translation\Bundle\Catalogue\CatalogueWriter - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - public: true - php_translation.catalogue_manager: - parent: Translation\Bundle\Catalogue\CatalogueManager - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - public: true - php_translation.extractor: - parent: Translation\Extractor\Extractor - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translation.storage_manager: - parent: Translation\Bundle\Service\StorageManager - public: true - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translation.configuration_manager: - parent: Translation\Bundle\Service\ConfigurationManager - public: true - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translation.importer: - parent: Translation\Bundle\Service\Importer - public: true - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translation.cache_clearer: - parent: Translation\Bundle\Service\CacheClearer - public: true - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translation.catalogue_counter: - parent: Translation\Bundle\Catalogue\CatalogueCounter - public: true - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' - php_translation.twig_extension: - parent: Translation\Bundle\Twig\TranslationExtension - deprecated: 'The "%service_id%" service is deprecated. You should stop using it, as it will be removed in the future.' From 95023bd4dde1dfe8600bd9c98a74349a214ba38c Mon Sep 17 00:00:00 2001 From: bocharsky-bw Date: Thu, 17 Jun 2021 23:30:03 +0300 Subject: [PATCH 2/5] Apply PHP CS Fixer recommendations --- Legacy/LegacyHelper.php | 3 +-- Resources/config/legacy/console.php | 2 +- Resources/config/legacy/edit_in_place.php | 2 +- Resources/config/legacy/extractors.php | 2 +- Resources/config/legacy/services.php | 2 +- 5 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Legacy/LegacyHelper.php b/Legacy/LegacyHelper.php index debb9c73..503d998a 100644 --- a/Legacy/LegacyHelper.php +++ b/Legacy/LegacyHelper.php @@ -32,7 +32,6 @@ public static function getMainRequest(RequestStack $requestStack) } /** - * @param ServicesConfigurator $servicesConfigurator * @param array[string $id, string $parent, ?bool $isPublic] $legacyServices */ public static function deprecateServices(ServicesConfigurator $servicesConfigurator, array $legacyServices) @@ -42,7 +41,7 @@ public static function deprecateServices(ServicesConfigurator $servicesConfigura $parent = $legacyService[1]; $isPublic = $legacyService[2] ?? false; - # Declare legacy services to remove in next major release + // Declare legacy services to remove in next major release $service = $servicesConfigurator->set($id) ->parent($parent); diff --git a/Resources/config/legacy/console.php b/Resources/config/legacy/console.php index 993237e2..7cd86ab4 100644 --- a/Resources/config/legacy/console.php +++ b/Resources/config/legacy/console.php @@ -9,7 +9,7 @@ use Translation\Bundle\Command\SyncCommand; use Translation\Bundle\Legacy\LegacyHelper; -return function(ContainerConfigurator $configurator) { +return function (ContainerConfigurator $configurator) { $services = $configurator->services(); LegacyHelper::deprecateServices($services, [ diff --git a/Resources/config/legacy/edit_in_place.php b/Resources/config/legacy/edit_in_place.php index 98d6d211..7e4a8f91 100644 --- a/Resources/config/legacy/edit_in_place.php +++ b/Resources/config/legacy/edit_in_place.php @@ -8,7 +8,7 @@ use Translation\Bundle\Translator\EditInPlaceTranslator; use Translation\Bundle\Twig\EditInPlaceExtension; -return function(ContainerConfigurator $configurator) { +return function (ContainerConfigurator $configurator) { $services = $configurator->services(); LegacyHelper::deprecateServices($services, [ diff --git a/Resources/config/legacy/extractors.php b/Resources/config/legacy/extractors.php index 0ae8c0f4..742f7ef8 100644 --- a/Resources/config/legacy/extractors.php +++ b/Resources/config/legacy/extractors.php @@ -19,7 +19,7 @@ use Translation\Extractor\Visitor\Php\Symfony\ValidationAnnotation; use Translation\Extractor\Visitor\Twig\TwigVisitor; -return function(ContainerConfigurator $configurator) { +return function (ContainerConfigurator $configurator) { $services = $configurator->services(); LegacyHelper::deprecateServices($services, [ diff --git a/Resources/config/legacy/services.php b/Resources/config/legacy/services.php index 5d75c13e..c43d05ee 100644 --- a/Resources/config/legacy/services.php +++ b/Resources/config/legacy/services.php @@ -14,7 +14,7 @@ use Translation\Bundle\Twig\TranslationExtension; use Translation\Extractor\Extractor; -return function(ContainerConfigurator $configurator) { +return function (ContainerConfigurator $configurator) { $services = $configurator->services(); LegacyHelper::deprecateServices($services, [ From 907829b957d49f5040bcae0db61d567c03314f25 Mon Sep 17 00:00:00 2001 From: bocharsky-bw Date: Thu, 17 Jun 2021 23:38:15 +0300 Subject: [PATCH 3/5] Fix the Kernel version ID number --- Legacy/LegacyHelper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Legacy/LegacyHelper.php b/Legacy/LegacyHelper.php index 503d998a..0f34b19e 100644 --- a/Legacy/LegacyHelper.php +++ b/Legacy/LegacyHelper.php @@ -45,7 +45,7 @@ public static function deprecateServices(ServicesConfigurator $servicesConfigura $service = $servicesConfigurator->set($id) ->parent($parent); - if (Kernel::VERSION_ID < 501000) { + if (Kernel::VERSION_ID < 50100) { $service->deprecate('Since php-translation/symfony-bundle 0.10.0: The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.'); } else { $service->deprecate('php-translation/symfony-bundle', '0.10.0', 'The "%service_id%" service is deprecated. You should stop using it, as it will soon be removed.'); From 48620fe9a0e71971b51d6d3e25d517568798ce12 Mon Sep 17 00:00:00 2001 From: bocharsky-bw Date: Fri, 18 Jun 2021 23:23:43 +0300 Subject: [PATCH 4/5] Simplify code: Remove unnecessary var --- Resources/config/legacy/console.php | 4 +--- Resources/config/legacy/edit_in_place.php | 4 +--- Resources/config/legacy/extractors.php | 4 +--- Resources/config/legacy/services.php | 4 +--- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Resources/config/legacy/console.php b/Resources/config/legacy/console.php index 7cd86ab4..2f8fea66 100644 --- a/Resources/config/legacy/console.php +++ b/Resources/config/legacy/console.php @@ -10,9 +10,7 @@ use Translation\Bundle\Legacy\LegacyHelper; return function (ContainerConfigurator $configurator) { - $services = $configurator->services(); - - LegacyHelper::deprecateServices($services, [ + LegacyHelper::deprecateServices($configurator->services(), [ ['php_translator.console.delete_obsolete', DeleteObsoleteCommand::class], ['php_translator.console.download', DownloadCommand::class], ['php_translator.console.extract', ExtractCommand::class], diff --git a/Resources/config/legacy/edit_in_place.php b/Resources/config/legacy/edit_in_place.php index 7e4a8f91..15e6a099 100644 --- a/Resources/config/legacy/edit_in_place.php +++ b/Resources/config/legacy/edit_in_place.php @@ -9,9 +9,7 @@ use Translation\Bundle\Twig\EditInPlaceExtension; return function (ContainerConfigurator $configurator) { - $services = $configurator->services(); - - LegacyHelper::deprecateServices($services, [ + LegacyHelper::deprecateServices($configurator->services(), [ ['php_translation.edit_in_place.response_listener', EditInPlaceResponseListener::class], ['php_translation.edit_in_place.activator', Activator::class], ['php_translator.edit_in_place.xtrans_html_translator', EditInPlaceTranslator::class], diff --git a/Resources/config/legacy/extractors.php b/Resources/config/legacy/extractors.php index 742f7ef8..68616641 100644 --- a/Resources/config/legacy/extractors.php +++ b/Resources/config/legacy/extractors.php @@ -20,9 +20,7 @@ use Translation\Extractor\Visitor\Twig\TwigVisitor; return function (ContainerConfigurator $configurator) { - $services = $configurator->services(); - - LegacyHelper::deprecateServices($services, [ + LegacyHelper::deprecateServices($configurator->services(), [ ['php_translation.extractor.php', PHPFileExtractor::class], ['php_translation.extractor.twig', TwigFileExtractor::class], ['php_translation.extractor.php.visitor.ContainerAwareTrans', ContainerAwareTrans::class], diff --git a/Resources/config/legacy/services.php b/Resources/config/legacy/services.php index c43d05ee..b7e7766b 100644 --- a/Resources/config/legacy/services.php +++ b/Resources/config/legacy/services.php @@ -15,9 +15,7 @@ use Translation\Extractor\Extractor; return function (ContainerConfigurator $configurator) { - $services = $configurator->services(); - - LegacyHelper::deprecateServices($services, [ + LegacyHelper::deprecateServices($configurator->services(), [ ['php_translation.catalogue_fetcher', CatalogueFetcher::class, true], ['php_translation.catalogue_writer', CatalogueWriter::class, true], ['php_translation.catalogue_manager', CatalogueManager::class, true], From 70518b7ba8e14ba6a286e3332ede0cd87365ea9f Mon Sep 17 00:00:00 2001 From: bocharsky-bw Date: Fri, 18 Jun 2021 23:24:51 +0300 Subject: [PATCH 5/5] Rename the method to registerDeprecatedServices() --- Legacy/LegacyHelper.php | 2 +- Resources/config/legacy/console.php | 2 +- Resources/config/legacy/edit_in_place.php | 2 +- Resources/config/legacy/extractors.php | 2 +- Resources/config/legacy/services.php | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Legacy/LegacyHelper.php b/Legacy/LegacyHelper.php index 0f34b19e..c59cba6d 100644 --- a/Legacy/LegacyHelper.php +++ b/Legacy/LegacyHelper.php @@ -34,7 +34,7 @@ public static function getMainRequest(RequestStack $requestStack) /** * @param array[string $id, string $parent, ?bool $isPublic] $legacyServices */ - public static function deprecateServices(ServicesConfigurator $servicesConfigurator, array $legacyServices) + public static function registerDeprecatedServices(ServicesConfigurator $servicesConfigurator, array $legacyServices) { foreach ($legacyServices as $legacyService) { $id = $legacyService[0]; diff --git a/Resources/config/legacy/console.php b/Resources/config/legacy/console.php index 2f8fea66..568b10e8 100644 --- a/Resources/config/legacy/console.php +++ b/Resources/config/legacy/console.php @@ -10,7 +10,7 @@ use Translation\Bundle\Legacy\LegacyHelper; return function (ContainerConfigurator $configurator) { - LegacyHelper::deprecateServices($configurator->services(), [ + LegacyHelper::registerDeprecatedServices($configurator->services(), [ ['php_translator.console.delete_obsolete', DeleteObsoleteCommand::class], ['php_translator.console.download', DownloadCommand::class], ['php_translator.console.extract', ExtractCommand::class], diff --git a/Resources/config/legacy/edit_in_place.php b/Resources/config/legacy/edit_in_place.php index 15e6a099..92127954 100644 --- a/Resources/config/legacy/edit_in_place.php +++ b/Resources/config/legacy/edit_in_place.php @@ -9,7 +9,7 @@ use Translation\Bundle\Twig\EditInPlaceExtension; return function (ContainerConfigurator $configurator) { - LegacyHelper::deprecateServices($configurator->services(), [ + LegacyHelper::registerDeprecatedServices($configurator->services(), [ ['php_translation.edit_in_place.response_listener', EditInPlaceResponseListener::class], ['php_translation.edit_in_place.activator', Activator::class], ['php_translator.edit_in_place.xtrans_html_translator', EditInPlaceTranslator::class], diff --git a/Resources/config/legacy/extractors.php b/Resources/config/legacy/extractors.php index 68616641..687b4b9d 100644 --- a/Resources/config/legacy/extractors.php +++ b/Resources/config/legacy/extractors.php @@ -20,7 +20,7 @@ use Translation\Extractor\Visitor\Twig\TwigVisitor; return function (ContainerConfigurator $configurator) { - LegacyHelper::deprecateServices($configurator->services(), [ + LegacyHelper::registerDeprecatedServices($configurator->services(), [ ['php_translation.extractor.php', PHPFileExtractor::class], ['php_translation.extractor.twig', TwigFileExtractor::class], ['php_translation.extractor.php.visitor.ContainerAwareTrans', ContainerAwareTrans::class], diff --git a/Resources/config/legacy/services.php b/Resources/config/legacy/services.php index b7e7766b..9daaf626 100644 --- a/Resources/config/legacy/services.php +++ b/Resources/config/legacy/services.php @@ -15,7 +15,7 @@ use Translation\Extractor\Extractor; return function (ContainerConfigurator $configurator) { - LegacyHelper::deprecateServices($configurator->services(), [ + LegacyHelper::registerDeprecatedServices($configurator->services(), [ ['php_translation.catalogue_fetcher', CatalogueFetcher::class, true], ['php_translation.catalogue_writer', CatalogueWriter::class, true], ['php_translation.catalogue_manager', CatalogueManager::class, true],