From 8b2284bdb9d543a95c9cad7272e9e6e996e621fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6sing?= <2189546+boesing@users.noreply.github.com> Date: Wed, 13 Sep 2023 23:31:35 +0200 Subject: [PATCH 1/3] bugfix: add missing `AdapterPluginManager` service to `ConfigProvider` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com> --- src/ConfigProvider.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index 878dd93..26da4f0 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -36,8 +36,9 @@ public function getDependencyConfig() // Legacy Zend Framework aliases 'aliases' => [], 'factories' => [ - 'SerializerAdapterManager' => AdapterPluginManagerFactory::class, - AdapterInterface::class => new GenericSerializerFactory(PhpSerialize::class), + 'SerializerAdapterManager' => AdapterPluginManagerFactory::class, + AdapterPluginManager::class => AdapterPluginManagerFactory::class, + AdapterInterface::class => new GenericSerializerFactory(PhpSerialize::class), ], ]; } From f043295590aaaba48cdfe1b1a29c19b4355971a1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6sing?= <2189546+boesing@users.noreply.github.com> Date: Wed, 13 Sep 2023 23:40:10 +0200 Subject: [PATCH 2/3] qa: add unit test to verify services provided by the `ConfigProvider` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com> --- composer.json | 4 ++-- composer.lock | 22 +++++++++++----------- src/ConfigProvider.php | 13 ++++++++++++- test/ConfigProviderTest.php | 35 +++++++++++++++++++++++++++++++++++ 4 files changed, 60 insertions(+), 14 deletions(-) create mode 100644 test/ConfigProviderTest.php diff --git a/composer.json b/composer.json index 09bcc3c..d8378b1 100644 --- a/composer.json +++ b/composer.json @@ -37,8 +37,8 @@ }, "require-dev": { "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-math": "~3.6.0", - "laminas/laminas-servicemanager": "~3.19.0", + "laminas/laminas-math": "^3.6", + "laminas/laminas-servicemanager": "^3.20", "phpunit/phpunit": "~9.6.0" }, "suggest": { diff --git a/composer.lock b/composer.lock index 25dc95e..685437e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "c89c3ceb4a9e0c62dab6183b90a02ee9", + "content-hash": "335af4cf5c938fc78de92e7729f62385", "packages": [ { "name": "laminas/laminas-json", @@ -398,16 +398,16 @@ }, { "name": "laminas/laminas-servicemanager", - "version": "3.19.0", + "version": "3.20.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "ed160729bb8721127efdaac799f9a298963345b1" + "reference": "bc2c2cbe2dd90db8b9d16b0618f542692b76ab59" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/ed160729bb8721127efdaac799f9a298963345b1", - "reference": "ed160729bb8721127efdaac799f9a298963345b1", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/bc2c2cbe2dd90db8b9d16b0618f542692b76ab59", + "reference": "bc2c2cbe2dd90db8b9d16b0618f542692b76ab59", "shasum": "" }, "require": { @@ -430,14 +430,14 @@ "require-dev": { "composer/package-versions-deprecated": "^1.11.99.5", "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-container-config-test": "^0.7", + "laminas/laminas-container-config-test": "^0.8", "laminas/laminas-dependency-plugin": "^2.2", "mikey179/vfsstream": "^1.6.11@alpha", "ocramius/proxy-manager": "^2.14.1", - "phpbench/phpbench": "^1.2.6", - "phpunit/phpunit": "^9.5.25", - "psalm/plugin-phpunit": "^0.17.0", - "vimeo/psalm": "^4.28" + "phpbench/phpbench": "^1.2.7", + "phpunit/phpunit": "^9.5.26", + "psalm/plugin-phpunit": "^0.18.0", + "vimeo/psalm": "^5.0.0" }, "suggest": { "ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services" @@ -484,7 +484,7 @@ "type": "community_bridge" } ], - "time": "2022-10-10T20:59:22+00:00" + "time": "2022-12-01T17:03:38+00:00" }, { "name": "myclabs/deep-copy", diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index 26da4f0..9f7ae70 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -10,7 +10,11 @@ use Laminas\Serializer\Adapter\AdapterInterface; use Laminas\Serializer\Adapter\PhpSerialize; +use Psr\Container\ContainerInterface; +/** + * @see ContainerInterface + */ class ConfigProvider { /** @@ -28,8 +32,15 @@ public function __invoke() /** * Return dependency mappings for this component. * - * @return array + * @return array{ + * factories: array< + * string, + * callable(ContainerInterface,?string,?array|null):object + * >, + * aliases: array + * } */ + // @phpcs:ignore SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingAnyTypeHint public function getDependencyConfig() { return [ diff --git a/test/ConfigProviderTest.php b/test/ConfigProviderTest.php new file mode 100644 index 0000000..e238b82 --- /dev/null +++ b/test/ConfigProviderTest.php @@ -0,0 +1,35 @@ +getDependencyConfig(); + self::assertArrayHasKey($serviceName, $dependencies['factories']); + } + + /** + * @return iterable + */ + public static function factoryServiceNames(): iterable + { + return [ + 'SerializerAdapterManager' => ['SerializerAdapterManager'], + AdapterPluginManager::class => [AdapterPluginManager::class], + AdapterInterface::class => [AdapterInterface::class], + ]; + } +} From 50139b3212312abe3d00ea87ddf12f0babcbcb86 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maximilian=20B=C3=B6sing?= <2189546+boesing@users.noreply.github.com> Date: Wed, 13 Sep 2023 23:48:35 +0200 Subject: [PATCH 3/3] qa: lock `laminas-servicemanager` MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Maximilian Bösing <2189546+boesing@users.noreply.github.com> --- composer.json | 2 +- composer.lock | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/composer.json b/composer.json index d8378b1..6e78602 100644 --- a/composer.json +++ b/composer.json @@ -38,7 +38,7 @@ "require-dev": { "laminas/laminas-coding-standard": "~2.4.0", "laminas/laminas-math": "^3.6", - "laminas/laminas-servicemanager": "^3.20", + "laminas/laminas-servicemanager": "~3.19.0", "phpunit/phpunit": "~9.6.0" }, "suggest": { diff --git a/composer.lock b/composer.lock index 685437e..11371e5 100644 --- a/composer.lock +++ b/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "335af4cf5c938fc78de92e7729f62385", + "content-hash": "c5def3a0c3fb04f56c86cd41a7f9744c", "packages": [ { "name": "laminas/laminas-json", @@ -398,16 +398,16 @@ }, { "name": "laminas/laminas-servicemanager", - "version": "3.20.0", + "version": "3.19.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-servicemanager.git", - "reference": "bc2c2cbe2dd90db8b9d16b0618f542692b76ab59" + "reference": "ed160729bb8721127efdaac799f9a298963345b1" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/bc2c2cbe2dd90db8b9d16b0618f542692b76ab59", - "reference": "bc2c2cbe2dd90db8b9d16b0618f542692b76ab59", + "url": "https://api.github.com/repos/laminas/laminas-servicemanager/zipball/ed160729bb8721127efdaac799f9a298963345b1", + "reference": "ed160729bb8721127efdaac799f9a298963345b1", "shasum": "" }, "require": { @@ -430,14 +430,14 @@ "require-dev": { "composer/package-versions-deprecated": "^1.11.99.5", "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-container-config-test": "^0.8", + "laminas/laminas-container-config-test": "^0.7", "laminas/laminas-dependency-plugin": "^2.2", "mikey179/vfsstream": "^1.6.11@alpha", "ocramius/proxy-manager": "^2.14.1", - "phpbench/phpbench": "^1.2.7", - "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.0", - "vimeo/psalm": "^5.0.0" + "phpbench/phpbench": "^1.2.6", + "phpunit/phpunit": "^9.5.25", + "psalm/plugin-phpunit": "^0.17.0", + "vimeo/psalm": "^4.28" }, "suggest": { "ocramius/proxy-manager": "ProxyManager ^2.1.1 to handle lazy initialization of services" @@ -484,7 +484,7 @@ "type": "community_bridge" } ], - "time": "2022-12-01T17:03:38+00:00" + "time": "2022-10-10T20:59:22+00:00" }, { "name": "myclabs/deep-copy",