If definition has only one tag return the definition not an array
JeanPaiva opened this issue · comments
Jean Paiva commented
The method League\Container\Container::get
always return an array of definitions if has a tag set.
If only one definition was found with that tag, it could be returned directly instead?
Simple use case:
$container->add(Slim\Http\Environment::class)->addArgument($_SERVER)->addTag('environment');
$container->add('request', function () use ($container) {
return Request::createFromEnvironment($container->get('environment')[0]);
}, true);
Phil Bennett commented
I think this makes the feature more complex, it was always supposed to replicate ArrayOf functionality so it's unlikely that I would change that behaviour.