To use `::class`, the event object must have already been created. To that I wonder if, when attaching events to listeners by name, should this really be a hard requirement (i.e. the event object being created)?
On Monday, August 20, 2018 at 8:27:10 PM UTC+5, Woody Gilk wrote: > > On Mon, Aug 20, 2018 at 10:16 AM <[email protected] <javascript:>> > wrote: > > > > Right. In that case, the string $eventName would have to be a fully > qualified event class name (including the namespace) for the emitter to > pick it up correctly. Isn't that a bit impractical? Or should we just be > looking at the event name and stripping off the namespace (in emitter) like > maybe by doing something like: > > > > $eventName = end(explode('\\', get_class($command))); > > I don't think it is impractical at all. Mapping by full class name is > very easy with `Foo::class` and FQCN prevents duplicate errors, eg: > > Acme\Domain\Task\UpdatedEvent > Acme\Domain\User\UpdatedEvent > > -- > Woody Gilk > https://shadowhand.me > -- You received this message because you are subscribed to the Google Groups "PHP Framework Interoperability Group" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/php-fig/8158bd9b-3458-4f55-94e9-d489f19fe87e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
