UsersRenamedListener   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 23
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A onAppUsersRenamed() 0 4 1
1
<?php
2
3
namespace Skobkin\Bundle\PointToolsBundle\EventListener;
4
5
use Skobkin\Bundle\PointToolsBundle\Event\UsersRenamedEvent;
6
use Skobkin\Bundle\PointToolsBundle\Service\Telegram\Notifier;
7
8
class UsersRenamedListener
9
{
10
    /**
11
     * @var Notifier
12
     */
13
    private $notifier;
14
15
16
    /**
17
     * UsersRenameNotifierListener constructor.
18
     *
19
     * @param Notifier $notifier
20
     */
21
    public function __construct(Notifier $notifier)
22
    {
23
        $this->notifier = $notifier;
24
    }
25
26
    public function onAppUsersRenamed(UsersRenamedEvent $event): void
27
    {
28
        $this->notifier->sendUsersRenamedNotification($event->getRenames());
0 ignored issues
show
Documentation introduced by
$event->getRenames() is of type array<integer,object<Sko...ntity\UserRenameEvent>>, but the function expects a array<integer,object<UserRenameEvent>>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
29
    }
30
}