Conditions | 2 |
Paths | 2 |
Total Lines | 11 |
Code Lines | 6 |
Lines | 0 |
Ratio | 0 % |
Tests | 6 |
CRAP Score | 2 |
Changes | 0 |
1 | <?php |
||
19 | 4 | public function run($id, $reload = false) |
|
20 | { |
||
21 | 4 | $model = new $this->modelClass; |
|
22 | 4 | $this->findModel($model, $id)->delete(); |
|
23 | |||
24 | 4 | if ($reload) { |
|
25 | 2 | return $this->controller->redirect(\yii\helpers\Url::to(['index'])); |
|
26 | } |
||
27 | |||
28 | 2 | return $this->controller->asJson(true); |
|
|
|||
29 | } |
||
30 | } |
||
31 |
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: