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