| 1 | <?php |
||
| 12 | class ResetPasswordForm extends Model |
||
| 13 | { |
||
| 14 | public $password; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * @var \common\models\User |
||
| 18 | */ |
||
| 19 | private $_user; |
||
| 20 | |||
| 21 | |||
| 22 | /** |
||
| 23 | * Creates a form model given a token. |
||
| 24 | * |
||
| 25 | * @param string $token |
||
| 26 | * @param array $config name-value pairs that will be used to initialize the object properties |
||
| 27 | * @throws \yii\base\InvalidParamException if token is empty or not valid |
||
| 28 | */ |
||
| 29 | public function __construct($token, $config = []) |
||
| 40 | |||
| 41 | /** |
||
| 42 | * @inheritdoc |
||
| 43 | */ |
||
| 44 | public function rules() |
||
| 51 | |||
| 52 | /** |
||
| 53 | * Resets password. |
||
| 54 | * |
||
| 55 | * @return boolean if password was reset. |
||
| 56 | */ |
||
| 57 | public function resetPassword() |
||
| 65 | } |
||
| 66 |
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
$accountIdthat can either hold an Id object or false (if there is no account id yet). Your code now assigns that value to theidproperty of an instance of theAccountclass. 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.