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

AlertWidget   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 1
cbo 2
dl 0
loc 12
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 6 2
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