diff --git a/composer.json b/composer.json index 09bcc3c..6e78602 100644 --- a/composer.json +++ b/composer.json @@ -37,7 +37,7 @@ }, "require-dev": { "laminas/laminas-coding-standard": "~2.4.0", - "laminas/laminas-math": "~3.6.0", + "laminas/laminas-math": "^3.6", "laminas/laminas-servicemanager": "~3.19.0", "phpunit/phpunit": "~9.6.0" }, diff --git a/composer.lock b/composer.lock index 25dc95e..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": "c89c3ceb4a9e0c62dab6183b90a02ee9", + "content-hash": "c5def3a0c3fb04f56c86cd41a7f9744c", "packages": [ { "name": "laminas/laminas-json", diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index 878dd93..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,16 +32,24 @@ 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 [ // 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), ], ]; } 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], + ]; + } +}