Regression in type inference of `@psalm-type ServiceManagerConfiguration` on `ServiceManager`?
Ocramius opened this issue · comments
Bug Report
Q | A |
---|---|
Version(s) | 3.20.0 |
Summary
When upgrading from 3.19.0
to 3.20.0
, the some type information got lost.
This is mostly visible in laminas/laminas-hydrator#100 and similar patches, where errors like this one occur:
Error: src/HydratorPluginManagerFactory.php:48:64: ArgumentTypeCoercion: Argument 2 of Laminas\Hydrator\HydratorPluginManager::__construct expects array{abstract_factories?: array<array-key, Laminas\ServiceManager\Factory\AbstractFactoryInterface|class-string<Laminas\ServiceManager\Factory\AbstractFactoryInterface>>, aliases?: array<string, string>, delegators?: array<string, array<array-key, Laminas\ServiceManager\Factory\DelegatorFactoryInterface|callable(Psr\Container\ContainerInterface, string, callable():object, array<array-key, mixed>|null):object|class-string<Laminas\ServiceManager\Factory\DelegatorFactoryInterface>>>, factories?: array<string, Laminas\ServiceManager\Factory\FactoryInterface|callable(Psr\Container\ContainerInterface, null|string, array<array-key, mixed>|null):object|class-string<Laminas\ServiceManager\Factory\FactoryInterface>>, initializers?: array<array-key, Laminas\ServiceManager\Initializer\InitializerInterface|callable(Psr\Container\ContainerInterface, object):void|class-string<Laminas\ServiceManager\Initializer\InitializerInterface>>, invokables?: array<string, string>, lazy_services?: array{class_map?: array<string, class-string>, proxies_namespace?: non-empty-string, proxies_target_dir?: non-empty-string, write_proxy_files?: bool}, services?: array<string, array<array-key, mixed>|object>, shared?: array<string, bool>, shared_by_default?: bool, ...<array-key, mixed>}, but parent type array<array-key, mixed> provided (see https://psalm.dev/193)
Seems like this declaration is mis-interpreted due to the final ...
laminas-servicemanager/src/ServiceManager.php
Lines 62 to 74 in e5cfad7
Possibly also a psalm bug?
I think this is because psalm 4.30 (present in the lockfile) does not understand ...
- Upgrading to psalm 5 in the these libs should just solve everything like mezzio/mezzio-laminasviewrenderer#33
Hmm, true that
Perhaps really a question of upgrading vimeo/psalm