Wait, `::class` works on objects?

On Mon, Aug 20, 2018, 09:38 <designc...@gmail.com> wrote:

> 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 <desig...@gmail.com> 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 php-fig+unsubscr...@googlegroups.com.
> To post to this group, send email to php-fig@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/php-fig/8158bd9b-3458-4f55-94e9-d489f19fe87e%40googlegroups.com
> <https://groups.google.com/d/msgid/php-fig/8158bd9b-3458-4f55-94e9-d489f19fe87e%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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 php-fig+unsubscr...@googlegroups.com.
To post to this group, send email to php-fig@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/php-fig/CAFjuE%2B%3DkwiZkZQ30p5pN59Eb5hLzLHTmv7vi_4hxVOn1FUjFkQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to