From 01ef3174f3c945c22462c5fc5f0e7693a60b9dc9 Mon Sep 17 00:00:00 2001 From: George Steel Date: Fri, 2 Dec 2022 16:42:24 +0000 Subject: [PATCH] Bump dev dependencies and improve config related type inference Signed-off-by: George Steel --- composer.json | 12 +++--- composer.lock | 40 +++++++++---------- psalm-baseline.xml | 15 +++---- src/ConfigProvider.php | 7 +++- src/Module.php | 7 +++- src/Translator/LoaderPluginManager.php | 4 +- src/Translator/LoaderPluginManagerFactory.php | 5 ++- 7 files changed, 53 insertions(+), 37 deletions(-) diff --git a/composer.json b/composer.json index 462014fb..2a704f99 100644 --- a/composer.json +++ b/composer.json @@ -38,17 +38,17 @@ "laminas/laminas-stdlib": "^2.7 || ^3.0" }, "require-dev": { - "laminas/laminas-cache": "^3.6", + "laminas/laminas-cache": "^3.8", "laminas/laminas-cache-storage-adapter-memory": "^2.2.0", "laminas/laminas-cache-storage-deprecated-factory": "^1.0.1", "laminas/laminas-coding-standard": "~2.4.0", "laminas/laminas-config": "^3.8.0", - "laminas/laminas-eventmanager": "^3.6.0", - "laminas/laminas-filter": "^2.23.0", - "laminas/laminas-validator": "^2.26.0", - "laminas/laminas-view": "^2.24.0", + "laminas/laminas-eventmanager": "^3.7", + "laminas/laminas-filter": "^2.28.1", + "laminas/laminas-validator": "^2.28", + "laminas/laminas-view": "^2.25", "phpunit/phpunit": "^9.5.26", - "psalm/plugin-phpunit": "^0.18.0", + "psalm/plugin-phpunit": "^0.18.3", "vimeo/psalm": "^5.0.0" }, "conflict": { diff --git a/composer.lock b/composer.lock index d51ebdcc..58ca7c3e 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "334be21c673254dd54fe8abe90315a55", + "content-hash": "74597be7c6693993524ed2f706402bd7", "packages": [ { "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": { @@ -40,14 +40,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" @@ -94,7 +94,7 @@ "type": "community_bridge" } ], - "time": "2022-10-10T20:59:22+00:00" + "time": "2022-12-01T17:03:38+00:00" }, { "name": "laminas/laminas-stdlib", @@ -1360,16 +1360,16 @@ }, { "name": "laminas/laminas-eventmanager", - "version": "3.6.0", + "version": "3.7.0", "source": { "type": "git", "url": "https://github.com/laminas/laminas-eventmanager.git", - "reference": "3f1afbad86cd34a431fdc069f265cfe6f8fc8308" + "reference": "b954c360182b9160026a8393d7b1b716dcae25d7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/laminas/laminas-eventmanager/zipball/3f1afbad86cd34a431fdc069f265cfe6f8fc8308", - "reference": "3f1afbad86cd34a431fdc069f265cfe6f8fc8308", + "url": "https://api.github.com/repos/laminas/laminas-eventmanager/zipball/b954c360182b9160026a8393d7b1b716dcae25d7", + "reference": "b954c360182b9160026a8393d7b1b716dcae25d7", "shasum": "" }, "require": { @@ -1382,11 +1382,11 @@ "require-dev": { "laminas/laminas-coding-standard": "~2.4.0", "laminas/laminas-stdlib": "^3.15", - "phpbench/phpbench": "^1.2.6", - "phpunit/phpunit": "^9.5.25", - "psalm/plugin-phpunit": "^0.17.0", + "phpbench/phpbench": "^1.2.7", + "phpunit/phpunit": "^9.5.26", + "psalm/plugin-phpunit": "^0.18.0", "psr/container": "^1.1.2 || ^2.0.2", - "vimeo/psalm": "^4.28" + "vimeo/psalm": "^5.0.0" }, "suggest": { "laminas/laminas-stdlib": "^2.7.3 || ^3.0, to use the FilterChain feature", @@ -1424,7 +1424,7 @@ "type": "community_bridge" } ], - "time": "2022-10-11T12:46:13+00:00" + "time": "2022-12-01T16:12:47+00:00" }, { "name": "laminas/laminas-filter", diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 0fef89fa..ec518aad 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -156,9 +156,8 @@ validatePlugin - + $aliases - $factories $plugin @@ -166,6 +165,9 @@ + + $options + LoaderPluginManagerFactory @@ -176,9 +178,6 @@ $config['translator_plugins'] - - $options - $container @@ -660,6 +659,9 @@ + + $this->toArray() + array @@ -667,10 +669,9 @@ $factory $target - + $alias $name - $this->toArray() $factory diff --git a/src/ConfigProvider.php b/src/ConfigProvider.php index 1eadd7ca..2218665e 100644 --- a/src/ConfigProvider.php +++ b/src/ConfigProvider.php @@ -15,7 +15,12 @@ class ConfigProvider /** * Return general-purpose laminas-i18n configuration. * - * @return array + * @return array{ + * dependencies: ServiceManagerConfigurationType, + * filters: ServiceManagerConfigurationType, + * validators: ServiceManagerConfigurationType, + * view_helpers: ServiceManagerConfigurationType, + * } */ public function __invoke() { diff --git a/src/Module.php b/src/Module.php index ad37904b..1a780941 100644 --- a/src/Module.php +++ b/src/Module.php @@ -15,7 +15,12 @@ class Module /** * Return laminas-i18n configuration for laminas-mvc application. * - * @return array + * @return array{ + * filters: ServiceManagerConfigurationType, + * service_manager: ServiceManagerConfigurationType, + * validators: ServiceManagerConfigurationType, + * view_helpers: ServiceManagerConfigurationType, + * } */ public function getConfig() { diff --git a/src/Translator/LoaderPluginManager.php b/src/Translator/LoaderPluginManager.php index e4d2a585..039feaf5 100644 --- a/src/Translator/LoaderPluginManager.php +++ b/src/Translator/LoaderPluginManager.php @@ -6,6 +6,7 @@ use Laminas\I18n\Translator\Loader\FileLoaderInterface; use Laminas\I18n\Translator\Loader\RemoteLoaderInterface; use Laminas\ServiceManager\AbstractPluginManager; +use Laminas\ServiceManager\ConfigInterface; use Laminas\ServiceManager\Exception\InvalidServiceException; use Laminas\ServiceManager\Factory\InvokableFactory; @@ -55,6 +56,7 @@ * * @template InstanceType of RemoteLoaderInterface|FileLoaderInterface * @extends AbstractPluginManager + * @psalm-import-type FactoriesConfigurationType from ConfigInterface */ class LoaderPluginManager extends AbstractPluginManager { @@ -79,7 +81,7 @@ class LoaderPluginManager extends AbstractPluginManager 'zendi18ntranslatorloaderphparray' => Loader\PhpArray::class, ]; - /** @var array */ + /** @var FactoriesConfigurationType */ protected $factories = [ Loader\Gettext::class => InvokableFactory::class, Loader\Ini::class => InvokableFactory::class, diff --git a/src/Translator/LoaderPluginManagerFactory.php b/src/Translator/LoaderPluginManagerFactory.php index f653c322..2711e037 100644 --- a/src/Translator/LoaderPluginManagerFactory.php +++ b/src/Translator/LoaderPluginManagerFactory.php @@ -5,10 +5,12 @@ use Laminas\ServiceManager\Config; use Laminas\ServiceManager\FactoryInterface; use Laminas\ServiceManager\ServiceLocatorInterface; +use Laminas\ServiceManager\ServiceManager; use Psr\Container\ContainerInterface; use function is_array; +/** @psalm-import-type ServiceManagerConfiguration from ServiceManager */ class LoaderPluginManagerFactory implements FactoryInterface { /** @@ -25,7 +27,8 @@ class LoaderPluginManagerFactory implements FactoryInterface * Create and return a LoaderPluginManager. * * @param string $name - * @param null|array $options + * @param array|null $options + * @psalm-param ServiceManagerConfiguration|null $options * @return LoaderPluginManager */ public function __invoke(ContainerInterface $container, $name, ?array $options = null)