It seems like $raw can also be of type double. However, the property $_raw is declared as type string|integer. 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...
52
}
53
8
$this->_create();
54
8
}
55
56
/**
57
* get the algorithm
58
*
59
* @since 4.3.0
60
*
61
* @return string|null
62
*/
63
64
4
public function getAlgorithm() : ?string
65
{
66
4
if (defined('PASSWORD_ARGON2ID'))
67
{
68
return constant('PASSWORD_ARGON2ID');
69
}
70
if (defined('PASSWORD_ARGON2I'))
71
{
72
return constant('PASSWORD_ARGON2I');
73
}
74
return constant('PASSWORD_DEFAULT');
75
}
76
77
4
/**
78
* get the raw
79
4
*
80
* @since 2.6.0
81
*
82
* @return string|int
83
*/
84
85
public function getRaw()
86
{
87
return $this->_raw;
88
}
89
90
/**
91
* get the hash
92
*
93
2
* @since 2.6.0
94
*
95
2
* @return string
96
*/
97
98
public function getHash() : string
99
{
100
return $this->_hash;
101
}
102
103
/**
104
8
* validate raw again hash
105
*
106
8
* @since 2.6.0
107
8
*
108
* @param string|int $raw plain raw
109
* @param string $hash salted hash
110
*
111
* @return bool
112
*/
113
114
public function validate($raw = null, string $hash = null) : bool
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.