SymfonyEventDispatcher   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 3
Bugs 0 Features 1
Metric Value
wmc 2
eloc 2
c 3
b 0
f 1
dl 0
loc 19
ccs 4
cts 4
cp 1
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 2 1
A dispatch() 0 4 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Yiisoft\Yii\Console;
6
7
use Psr\EventDispatcher\EventDispatcherInterface as PsrEventDispatcherInterface;
8
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface;
9
10
final class SymfonyEventDispatcher implements EventDispatcherInterface
11
{
12 49
    public function __construct(private PsrEventDispatcherInterface $dispatcher)
13
    {
14 49
    }
15
16
    /**
17
     * Dispatches an event to all registered listeners.
18
     *
19
     * @psalm-template T as object
20
     *
21
     * @psalm-param T $event
22
     *
23
     * @psalm-return T
24
     */
25 5
    public function dispatch(object $event, string $eventName = null): object
26
    {
27
        /** @psalm-var T */
28 5
        return $this->dispatcher->dispatch($event);
29
    }
30
}
31