1 | <?php namespace Conner\Tagging\Events; |
||
2 | |||
3 | use Conner\Tagging\Taggable; |
||
4 | use Illuminate\Queue\SerializesModels; |
||
5 | use Illuminate\Database\Eloquent\Model; |
||
6 | |||
7 | class TagAdded |
||
8 | { |
||
9 | use SerializesModels; |
||
0 ignored issues
–
show
introduced
by
Loading history...
|
|||
10 | |||
11 | /** @var \Illuminate\Database\Eloquent\Model **/ |
||
12 | public $model; |
||
13 | |||
14 | /** |
||
15 | * Create a new event instance. |
||
16 | * |
||
17 | * @param Taggable|Model $model |
||
18 | * @return void |
||
19 | */ |
||
20 | public function __construct($model) |
||
21 | { |
||
22 | $this->model = $model; |
||
0 ignored issues
–
show
It seems like
$model can also be of type Conner\Tagging\Taggable . However, the property $model is declared as type Illuminate\Database\Eloquent\Model . 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...
|
|||
23 | } |
||
24 | } |