Completed
Push — master ( 4d7f55...e57be4 )
by Travis
02:06
created

UserRegistered   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 1
c 1
b 0
f 0
lcom 0
cbo 1
dl 0
loc 17
rs 10

1 Method

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
1
<?php
2
3
namespace NukaCode\Users\Events;
4
5
use App\Events\Event;
6
use Illuminate\Queue\SerializesModels;
7
use Illuminate\Contracts\Broadcasting\ShouldBroadcast;
8
9
class UserRegistered extends Event
10
{
11
    use SerializesModels;
12
13
    /**
14
     * @var \NukaCode\Users\Models\User
15
     */
16
    public $user;
17
18
    /**
19
     * Create a new event instance.
20
     */
21
    public function __construct(User $user)
22
    {
23
        $this->user = $user;
0 ignored issues
show
Documentation Bug introduced by
$user is of type object<NukaCode\Users\Events\User>, but the property $user was declared to be of type object<NukaCode\Users\Models\User>. 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...
24
    }
25
}
26