container
container copied to clipboard
Add generics to ContainerInterface
WDYT?
Duplicates #35?
Quite close indeed. I'd just not add generics to the keys. Despite #35 being closed, I still think this would be a good idea. Locators scoped to some interface are quite common. It'd be great to hint autocompletion about them:
ContainerInterface<Foo> $container->get('bar')->... and be suggested with what Foo provides.
The fact that psalm/phpstan would complain about this shouldn't be a blocker to me. Eg they could stop complaining when the template type is of mixed.
to clarify, TS is super explicit here :) T extends String vs T extends String = String vs T = String vs T