Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
WildcardListenerProvider
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 __invoke
n/a
0 / 0
n/a
0 / 0
0
 getListenersForEvent
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5/**
6 * This file is part of php-fast-forward/event-dispatcher.
7 *
8 * This source file is subject to the license bundled
9 * with this source code in the file LICENSE.
10 *
11 * @copyright Copyright (c) 2025-2026 Felipe SayĆ£o Lobato Abreu <github@mentordosnerds.com>
12 * @license   https://opensource.org/licenses/MIT MIT License
13 *
14 * @see       https://github.com/php-fast-forward/event-dispatcher
15 * @see       https://github.com/php-fast-forward
16 * @see       https://datatracker.ietf.org/doc/html/rfc2119
17 */
18
19namespace FastForward\EventDispatcher\ListenerProvider;
20
21use Psr\EventDispatcher\ListenerProviderInterface;
22
23/**
24 * Expose an invokable wildcard listener as a PSR-14 listener provider.
25 */
26abstract class WildcardListenerProvider implements ListenerProviderInterface
27{
28    /**
29     * Handle the provided event.
30     *
31     * @param object $event event emitted by the dispatcher
32     */
33    abstract public function __invoke(object $event): void;
34
35    /**
36     * Yield the current listener for any dispatched object.
37     *
38     * @param object $event event being dispatched
39     *
40     * @return iterable<callable(object): void> matching listeners
41     */
42     public function getListenersForEvent(object $event): iterable
43    {
44        yield $this;
45    }
46}