It seems like $date_purchased can also be of type object<DateTime>. However, the property $date_purchased is declared as type object<Khepin\Fixture\Document\type>. 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 $accountId that can either hold an
Id object or false (if there is no account id yet). Your code now assigns that
value to the id property of an instance of the Account class. This class
holds a proper account, so the id value must no longer be false.
Either this assignment is in error or a type check should be added for that assignment.
classId{public$id;publicfunction__construct($id){$this->id=$id;}}classAccount{/** @var Id $id */public$id;}$account_id=false;if(starsAreRight()){$account_id=newId(42);}$account=newAccount();if($accountinstanceofId){$account->id=$account_id;}
Loading history...
36
}
37
38
public function getId()
39
{
40
return $this->id;
41
}
42
43
public function getName()
44
{
45
return $this->name;
46
}
47
48
public function setName($name)
49
{
50
$this->name = $name;
51
}
52
53
public function getDatePurchased()
54
{
55
return $this->date_purchased;
56
}
57
58
public function setDatePurchased(\DateTime $date_purchased)
It seems like $date_purchased of type object<DateTime> is incompatible with the declared type object<Khepin\Fixture\Document\type> of property $date_purchased.
Our type inference engine has found an assignment to a property that is incompatible
with the declared type of that property.
Either this assignment is in error or the assigned type should be added
to the documentation/type hint for that property..
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
$accountId
that can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theid
property of an instance of theAccount
class. This class holds a proper account, so the id value must no longer be false.Either this assignment is in error or a type check should be added for that assignment.