Skip to content

Commit

Permalink
Merge pull request #89 from gsteel/service-manager-types
Browse files Browse the repository at this point in the history
Bump dev dependencies and improve config related type inference
  • Loading branch information
Ocramius committed Dec 2, 2022
2 parents 2b4d0ab + 01ef317 commit fbd2d03
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 37 deletions.
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand Down
40 changes: 20 additions & 20 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 8 additions & 7 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,16 +156,18 @@
<MissingReturnType occurrences="1">
<code>validatePlugin</code>
</MissingReturnType>
<NonInvariantDocblockPropertyType occurrences="2">
<NonInvariantDocblockPropertyType occurrences="1">
<code>$aliases</code>
<code>$factories</code>
</NonInvariantDocblockPropertyType>
<ParamNameMismatch occurrences="2">
<code>$plugin</code>
<code>$plugin</code>
</ParamNameMismatch>
</file>
<file src="src/Translator/LoaderPluginManagerFactory.php">
<ArgumentTypeCoercion occurrences="1">
<code>$options</code>
</ArgumentTypeCoercion>
<DeprecatedInterface occurrences="1">
<code>LoaderPluginManagerFactory</code>
</DeprecatedInterface>
Expand All @@ -176,9 +178,6 @@
<MixedArgument occurrences="1">
<code>$config['translator_plugins']</code>
</MixedArgument>
<MixedArgumentTypeCoercion occurrences="1">
<code>$options</code>
</MixedArgumentTypeCoercion>
<ParamNameMismatch occurrences="1">
<code>$container</code>
</ParamNameMismatch>
Expand Down Expand Up @@ -660,17 +659,19 @@
</MixedReturnStatement>
</file>
<file src="src/View/HelperConfig.php">
<ArgumentTypeCoercion occurrences="1">
<code>$this-&gt;toArray()</code>
</ArgumentTypeCoercion>
<LessSpecificImplementedReturnType occurrences="1">
<code>array</code>
</LessSpecificImplementedReturnType>
<MixedArgument occurrences="2">
<code>$factory</code>
<code>$target</code>
</MixedArgument>
<MixedArgumentTypeCoercion occurrences="3">
<MixedArgumentTypeCoercion occurrences="2">
<code>$alias</code>
<code>$name</code>
<code>$this-&gt;toArray()</code>
</MixedArgumentTypeCoercion>
<MixedAssignment occurrences="2">
<code>$factory</code>
Expand Down
7 changes: 6 additions & 1 deletion src/ConfigProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ class ConfigProvider
/**
* Return general-purpose laminas-i18n configuration.
*
* @return array<string, ServiceManagerConfigurationType>
* @return array{
* dependencies: ServiceManagerConfigurationType,
* filters: ServiceManagerConfigurationType,
* validators: ServiceManagerConfigurationType,
* view_helpers: ServiceManagerConfigurationType,
* }
*/
public function __invoke()
{
Expand Down
7 changes: 6 additions & 1 deletion src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,12 @@ class Module
/**
* Return laminas-i18n configuration for laminas-mvc application.
*
* @return array<string, ServiceManagerConfigurationType>
* @return array{
* filters: ServiceManagerConfigurationType,
* service_manager: ServiceManagerConfigurationType,
* validators: ServiceManagerConfigurationType,
* view_helpers: ServiceManagerConfigurationType,
* }
*/
public function getConfig()
{
Expand Down
4 changes: 3 additions & 1 deletion src/Translator/LoaderPluginManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -55,6 +56,7 @@
*
* @template InstanceType of RemoteLoaderInterface|FileLoaderInterface
* @extends AbstractPluginManager<InstanceType>
* @psalm-import-type FactoriesConfigurationType from ConfigInterface
*/
class LoaderPluginManager extends AbstractPluginManager
{
Expand All @@ -79,7 +81,7 @@ class LoaderPluginManager extends AbstractPluginManager
'zendi18ntranslatorloaderphparray' => Loader\PhpArray::class,
];

/** @var array<string, class-string> */
/** @var FactoriesConfigurationType */
protected $factories = [
Loader\Gettext::class => InvokableFactory::class,
Loader\Ini::class => InvokableFactory::class,
Expand Down
5 changes: 4 additions & 1 deletion src/Translator/LoaderPluginManagerFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
/**
Expand All @@ -25,7 +27,8 @@ class LoaderPluginManagerFactory implements FactoryInterface
* Create and return a LoaderPluginManager.
*
* @param string $name
* @param null|array $options
* @param array<string, mixed>|null $options
* @psalm-param ServiceManagerConfiguration|null $options
* @return LoaderPluginManager
*/
public function __invoke(ContainerInterface $container, $name, ?array $options = null)
Expand Down

0 comments on commit fbd2d03

Please sign in to comment.