Hi Florian.
In PSR-14, the Provider can use whatever criteria it wants to determine the Listeners that are relevant for an Event, provided that the Listeners are type compatible. Reflecting on the parameter type is an obvious way, and the way we expect most implementations will do it, but that's not a requirement.
So if you're registering a Listener with a Provider, it's up to you how the Provider chooses to determine what Events it should apply to. That is, if someone does this:
$provider = new FlorianProvider();
$provider->addListener(function ($event) { });
Then addListener() is part of *your* API, not PSR-14. Throwing an exception, ignoring it, registering it for all events, those are all valid ways to implement *your* API, as long as what FlorianProvider::getListenersForEvent() returns is type-compatible with the event it's passed.
For me personally, I would likely choose to error on no-type and interpret `object` to mean "all events", since it's type compatible.
My own PSR-14 implementation, Tukio (
https://github.com/crell/tukio), allows users to register listeners in a variety of ways with both reflection and explicit type specification. Some approaches only support explicit, others support both.
The PSR-14 util package also includes some examples of registering based on more criteria than just the type, which is also entirely valid.
In short, "it's up to you". :-)
Cheers.
--Larry Garfield