EventHandlerFailedHandlingEvent   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 0
dl 0
loc 20
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 8 1
1
<?php
2
3
namespace Spatie\EventProjector\Events;
4
5
use Exception;
6
use Spatie\EventProjector\StoredEvent;
7
use Spatie\EventProjector\EventHandlers\EventHandler;
8
9
final class EventHandlerFailedHandlingEvent
10
{
11
    /** @var \Spatie\EventProjector\EventHandlers\EventHandler */
12
    public $eventHandler;
13
14
    /** @var \Spatie\EventProjector\Models\EloquentStoredEvent */
15
    public $storedEvent;
16
17
    /** @var \Exception */
18
    public $exception;
19
20
    public function __construct(EventHandler $eventHandler, StoredEvent $storedEvent, Exception $exception)
21
    {
22
        $this->eventHandler = $eventHandler;
23
24
        $this->storedEvent = $storedEvent;
0 ignored issues
show
Documentation Bug introduced by
$storedEvent is of type object<Spatie\EventProjector\StoredEvent>, but the property $storedEvent was declared to be of type object<Spatie\EventProje...ls\EloquentStoredEvent>. Are you sure that you always receive this specific sub-class here, or does it make sense to add an instanceof check?

Our type inference engine has found a suspicous assignment of a value to a property. This check raises an issue when a value that can be of a given class or a super-class is assigned to a property that is type hinted more strictly.

Either this assignment is in error or an instanceof check should be added for that assignment.

class Alien {}

class Dalek extends Alien {}

class Plot
{
    /** @var  Dalek */
    public $villain;
}

$alien = new Alien();
$plot = new Plot();
if ($alien instanceof Dalek) {
    $plot->villain = $alien;
}
Loading history...
25
26
        $this->exception = $exception;
27
    }
28
}
29