-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
When trying to use the types setup in laminas/laminas-servicemanager its telling me that I'm using an invalid return type. It appears the reason is due to errors when analysing laminas/laminas-servicemanager src/ConfigInterface.php.
/**
* @phpstan-import-type ServiceManagerConfigurationType from ConfigInterface
*/
final class ConfigProvider {
/**
* @return array{dependencies: ServiceManagerConfigurationType}
*/
public function __invoke(): array
{
return [
'dependencies' => [
'factories' => [
'doctrine.entity_manager.orm_default' => EntityManagerFactory::class,
],
],
];
}
}Gives the following errors:
- Method ConfigProvider::__invoke() return type has no value type specified in iterable type array.
- Method ConfigProvider::dependencies() has invalid return type Laminas\ServiceManager\DelegatorsConfigurationType.
- Method ConfigProvider::dependencies() has invalid return type Laminas\ServiceManager\FactoriesConfigurationType.
- Method ConfigProvider::dependencies() has invalid return type Laminas\ServiceManager\InitializersConfigurationType.
- Method ConfigProvider::dependencies() return type has no value type specified in iterable type array.
- Method ConfigProvider::dependencies() should return array{......} but returns array{......}. Offset 'factories' (Laminas\ServiceManager\FactoriesConfigurationType) does not accept type array<string, string>.
Code snippet that reproduces the problem
https://phpstan.org/r/c42f32d0-68fb-4a6d-a0e8-9e180ded8d6c
Note the above is running phpstan on the relevant class in laminas/laminas-servicemanager, however these same errors show up when importing this type in a ConfigProvider.
Expected output
I should be able to use the types provided by laminas/laminas-servicemanager without error.
Did PHPStan help you today? Did it make you happy in any way?
I had to stop my sponsorship due to a change in circumstances however I do aim to start this again when possible. As always many thanks.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels