1 | <?php |
||
38 | class VerifyAction extends Action |
||
39 | { |
||
40 | |||
41 | use EnsureUserBehaviorAttachedTrait; |
||
42 | |||
43 | /** |
||
44 | * @var string the name of view file if not set an id of this action will be use. |
||
45 | */ |
||
46 | public $viewFile; |
||
47 | |||
48 | /** |
||
49 | * @var string the name of variable in view refer to an object of `vxm\mfa\OtpForm`. |
||
50 | */ |
||
51 | public $formVar = 'model'; |
||
52 | |||
53 | /** |
||
54 | * @var callable|null when an identity had been verified it will be call. If not set, [[\yii\web\Controller::goBack()]] will be call. |
||
55 | * This action will be parse at first param and `vxm\mfa\OtpForm` is second param |
||
56 | * Example: |
||
57 | * |
||
58 | * ```php |
||
59 | * 'successCallback' => function(\vxm\mfa\VerifyAction $action, \vxm\mfa\OtpForm $otp) { |
||
60 | * |
||
61 | * return $action->controller->redirect(['site/dash-board']); |
||
62 | * } |
||
63 | * |
||
64 | * ``` |
||
65 | */ |
||
66 | public $successCallback; |
||
67 | |||
68 | /** |
||
69 | * @var callable|null when an user submit wrong otp it will be call, if not set, [[yii\web\User::loginRequired()]] will be call. |
||
70 | * This action will be parse at first param and `vxm\mfa\OtpForm` is second param |
||
71 | * Example: |
||
72 | * |
||
73 | * ```php |
||
74 | * 'invalidCallback' => function(\vxm\mfa\VerifyAction $action, \vxm\mfa\OtpForm $otp) { |
||
75 | * Yii::$app->session->setFlash('Otp is not valid'); |
||
76 | * |
||
77 | * return $action->controller->redirect(['site/login']); |
||
78 | * } |
||
79 | * |
||
80 | * ``` |
||
81 | */ |
||
82 | public $invalidCallback; |
||
83 | |||
84 | /** |
||
85 | * @var bool weather allow user can retry when type wrong or not. |
||
86 | */ |
||
87 | public $retry = false; |
||
88 | |||
89 | /** |
||
90 | * @var string the form class handle end-user data |
||
91 | */ |
||
92 | public $formClass = OtpForm::class; |
||
93 | |||
94 | /** |
||
95 | * @inheritDoc |
||
96 | * @throws InvalidConfigException |
||
97 | */ |
||
98 | 4 | public function init() |
|
105 | |||
106 | /** |
||
107 | * @inheritDoc |
||
108 | */ |
||
109 | 4 | public function beforeRun() |
|
121 | |||
122 | /** |
||
123 | * @return mixed|string|\yii\web\Response |
||
124 | * @throws \yii\web\ForbiddenHttpException |
||
125 | */ |
||
126 | 3 | public function run() |
|
156 | |||
157 | } |
||
158 |
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: