Conditions | 2 |
Paths | 1 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 6 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
35 | public function rules() |
||
36 | { |
||
37 | return [ |
||
38 | [['oldPassword', 'newPassword',], 'required'], |
||
39 | ['newPassword', function () { |
||
40 | if (!(new Security())->validatePassword($this->oldPassword, Yii::$app->getUser()->identity->pass_hash)) { |
||
|
|||
41 | $this->addError('oldPassword', Yii::t('activeuser_frontend', 'Invalid old password')); |
||
42 | } |
||
43 | }], |
||
44 | ]; |
||
45 | } |
||
46 | |||
71 |
It seems like the method you are trying to call exists only in some of the possible types.
Let’s take a look at an example:
Available Fixes
Add an additional type-check:
Only allow a single type to be passed if the variable comes from a parameter: