Completed
Push — master ( 467674...3ccd8e )
by Dmitry
22:59 queued 08:05
created

AlertWidget::run()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 6
rs 10
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace hiqdev\thememanager\widgets;
4
5
use Yii;
6
use yii\base\Widget;
7
8
class AlertWidget extends Widget
9
{
10
    /** @var mixed */
11
    public $widget;
12
13
    public function run()
14
    {
15
        if (!empty($this->widget)) {
16
            return Yii::createObject($this->widget)->run();
0 ignored issues
show
Documentation introduced by
$this->widget is of type *, but the function expects a callable.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
17
        }
18
    }
19
}
20