1 | <?php |
||
2 | |||
3 | namespace Conner\Tagging\Events; |
||
4 | |||
5 | use Conner\Tagging\Taggable; |
||
6 | use Illuminate\Database\Eloquent\Model; |
||
7 | use Illuminate\Queue\SerializesModels; |
||
8 | |||
9 | class TagRemoved |
||
10 | { |
||
11 | use SerializesModels; |
||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
12 | |||
13 | /** @var \Conner\Tagging\Taggable **/ |
||
14 | public $model; |
||
15 | |||
16 | /** |
||
17 | * Create a new event instance. |
||
18 | * |
||
19 | * @param Taggable|Model $model |
||
20 | * @return void |
||
21 | */ |
||
22 | public function __construct($model) |
||
23 | { |
||
24 | $this->model = $model; |
||
0 ignored issues
–
show
It seems like
$model can also be of type Illuminate\Database\Eloquent\Model . However, the property $model is declared as type Conner\Tagging\Taggable . Maybe add an additional type 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 mixed type is assigned to a property that is type hinted more strictly. For example, imagine you have a variable Either this assignment is in error or a type check should be added for that assignment. class Id
{
public $id;
public function __construct($id)
{
$this->id = $id;
}
}
class Account
{
/** @var Id $id */
public $id;
}
$account_id = false;
if (starsAreRight()) {
$account_id = new Id(42);
}
$account = new Account();
if ($account instanceof Id)
{
$account->id = $account_id;
}
Loading history...
|
|||
25 | } |
||
26 | } |