These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /** |
||
3 | * Health monitoring for Yii2 applications |
||
4 | * |
||
5 | * @link https://github.com/hiqdev/yii2-monitoring |
||
6 | * @package yii2-monitoring |
||
7 | * @license BSD-3-Clause |
||
8 | * @copyright Copyright (c) 2017, HiQDev (http://hiqdev.com/) |
||
9 | */ |
||
10 | |||
11 | namespace hiqdev\yii2\monitoring\controllers; |
||
12 | |||
13 | use hiqdev\yii2\monitoring\actions\ErrorAction; |
||
14 | use hiqdev\yii2\monitoring\logic\DebugSessionSaver; |
||
15 | use hiqdev\yii2\monitoring\logic\FeedbackSender; |
||
16 | use hiqdev\yii2\monitoring\models\FeedbackForm; |
||
17 | use Yii; |
||
18 | use yii\web\Controller; |
||
19 | |||
20 | class ErrorController extends Controller |
||
21 | { |
||
22 | public function actions() |
||
23 | { |
||
24 | return [ |
||
25 | 'index' => ErrorAction::class, |
||
26 | ]; |
||
27 | } |
||
28 | |||
29 | public function actionSend() |
||
30 | { |
||
31 | $form = new FeedbackForm(); |
||
32 | |||
33 | if ($form->load(Yii::$app->request->post()) && $form->validate()) { |
||
34 | /** @var FeedbackSender $sender */ |
||
35 | Yii::createObject(DebugSessionSaver::class, [$form->session_tag])->run(); |
||
36 | $sender = Yii::createObject(FeedbackSender::class, [$form]); |
||
37 | |||
38 | return $this->render('sent', [ |
||
39 | 'model' => $form, |
||
40 | 'success' => $sender->send(), |
||
41 | ]); |
||
42 | } |
||
43 | |||
44 | return $this->redirect(Yii::$app->getHomeUrl()); |
||
0 ignored issues
–
show
|
|||
45 | } |
||
46 | |||
47 | public function actionTest() |
||
48 | { |
||
49 | Yii::error('testing error'); |
||
50 | throw new \Exception('testing exception'); |
||
51 | } |
||
52 | } |
||
53 |
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: