| Conditions | 5 |
| Paths | 4 |
| Total Lines | 23 |
| Lines | 5 |
| Ratio | 21.74 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 48 | public function run() |
||
| 49 | { |
||
| 50 | if (!Yii::$app->user->isGuest) { |
||
| 51 | return $this->redirectTo(Yii::$app->getHomeUrl()); |
||
| 52 | } |
||
| 53 | |||
| 54 | $model = Yii::createObject($this->modelClass); |
||
| 55 | $load = $model->load(Yii::$app->request->post()); |
||
| 56 | |||
| 57 | View Code Duplication | if (Yii::$app->request->isAjax) { |
|
| 58 | Yii::$app->response->format = Response::FORMAT_JSON; |
||
| 59 | |||
| 60 | return ActiveForm::validate($model); |
||
| 61 | } |
||
| 62 | |||
| 63 | if ($load && $model->login()) { |
||
| 64 | return $this->redirectTo(Yii::$app->getUser()->getReturnUrl()); |
||
| 65 | } |
||
| 66 | |||
| 67 | return $this->controller->render($this->view, [ |
||
| 68 | 'model' => $model, |
||
| 69 | ]); |
||
| 70 | } |
||
| 71 | } |
||
| 72 |
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: