I'm trying to inject an array of implementations of a certain interface to a subscriber class.
This is the code in my service provider:
$this->app->tag([TrackerServiceOne::class, TrackerServiceTwo::class], 'trackers');
$this->app->bind(EventSubscriber::class, function ($app) {
return new EventSubscriber($this->app->tagged('trackers'));
});
And this is the constructor in my EventSubscriber class:
public function __construct(array $trackers)
{
$this->trackers = $trackers;
}
This is the error I'm getting:
Unresolvable dependency resolving [Parameter #0 [ <required> array $trackers ]] in class Path\To\EventSubscriber