From e6d0d4cadd9e7ead5ac9b5183d9b893bc5e0b881 Mon Sep 17 00:00:00 2001 From: ramchale Date: Mon, 21 Oct 2024 17:59:32 +0100 Subject: [PATCH] Reduce use of deprecated Laminas\ServiceManager\ConfigInterface Remove all uses except HelperConfig, which inherits so removal would be a breaking change Signed-off-by: ramchale --- psalm-baseline.xml | 16 ---------------- src/Translator/LoaderPluginManagerFactory.php | 3 +-- test/Translator/TranslatorTest.php | 14 +++++--------- 3 files changed, 6 insertions(+), 27 deletions(-) diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 0d9ffb99..f75c811a 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -166,9 +166,6 @@ creationOptions]]> - - - @@ -876,19 +873,6 @@ - - [ - 'test' => $loader, - ], - ])]]> - [ - 'test' => $loader, - ], - ])]]> - ['test' => $loader]])]]> - diff --git a/src/Translator/LoaderPluginManagerFactory.php b/src/Translator/LoaderPluginManagerFactory.php index ea2c8a46..be2aebb8 100644 --- a/src/Translator/LoaderPluginManagerFactory.php +++ b/src/Translator/LoaderPluginManagerFactory.php @@ -2,7 +2,6 @@ namespace Laminas\I18n\Translator; -use Laminas\ServiceManager\Config; use Laminas\ServiceManager\FactoryInterface; use Laminas\ServiceManager\ServiceLocatorInterface; use Laminas\ServiceManager\ServiceManager; @@ -55,7 +54,7 @@ public function __invoke(ContainerInterface $container, $name, ?array $options = } // Wire service configuration for translator_plugins - (new Config($config['translator_plugins']))->configureServiceManager($pluginManager); + $pluginManager->configure($config['translator_plugins']); return $pluginManager; } diff --git a/test/Translator/TranslatorTest.php b/test/Translator/TranslatorTest.php index c865581f..50924d57 100644 --- a/test/Translator/TranslatorTest.php +++ b/test/Translator/TranslatorTest.php @@ -10,7 +10,6 @@ use Laminas\EventManager\EventInterface; use Laminas\I18n\Translator\TextDomain; use Laminas\I18n\Translator\Translator; -use Laminas\ServiceManager\Config; use LaminasTest\I18n\TestCase; use LaminasTest\I18n\Translator\TestAsset\Loader as TestLoader; use Locale; @@ -157,13 +156,12 @@ public function testTranslate(): void { $loader = new TestLoader(); $loader->textDomain = new TextDomain(['foo' => 'bar']); - $config = new Config([ + $pm = $this->translator->getPluginManager(); + $pm->configure([ 'services' => [ 'test' => $loader, ], ]); - $pm = $this->translator->getPluginManager(); - $config->configureServiceManager($pm); $this->translator->setPluginManager($pm); $this->translator->addTranslationFile('test', null); @@ -190,9 +188,8 @@ public function testTranslationsAreStoredInCache(): void $loader = new TestLoader(); $loader->textDomain = new TextDomain(['foo' => 'bar']); - $config = new Config(['services' => ['test' => $loader]]); $plugins = $this->translator->getPluginManager(); - $config->configureServiceManager($plugins); + $plugins->configure(['services' => ['test' => $loader]]); $this->translator->setPluginManager($plugins); $this->translator->addTranslationFile('test', null); @@ -537,13 +534,12 @@ public function testNullMessageArgumentShouldReturnAnEmptyString(): void { $loader = new TestLoader(); $loader->textDomain = new TextDomain(['foo' => 'bar']); - $config = new Config([ + $pm = $this->translator->getPluginManager(); + $pm->configure([ 'services' => [ 'test' => $loader, ], ]); - $pm = $this->translator->getPluginManager(); - $config->configureServiceManager($pm); $this->translator->setPluginManager($pm); $this->translator->addTranslationFile('test', null);