It seems like $info === null ? '' : $info can also be of type object<Gwa\Exception\gwCoreException>. However, the property $info is declared as type string. 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...
30
}
31
32
/**
33
* Exception setter.
34
*
35
* @param gwCoreException $exception
36
*/
37
final public function setException(gwCoreException $exception)
38
{
39
$this->exception = $exception;
40
}
41
42
/**
43
* Returns a string representation of this object.
44
*
45
* @return string
46
*/
47
public function __toString()
48
{
49
return $this->fetch();
50
}
51
52
/**
53
* Returns a plain text representation of the info contained in this object.
54
*
55
* @return string
56
*/
57
public function fetch()
58
{
59
return $this->info;
60
}
61
62
/**
63
* Returns a HTML representation of the info contained in this object.
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive.
Most often this is a case of a parameter that can be null in addition to its declared types.