Issues (27)

backend/components/grid/ActionColumn.php (1 issue)

Labels
Severity
1
<?php
2
namespace backend\components\grid;
3
4
use yii\grid\ActionColumn as BaseActionColumn;
5
6
class ActionColumn extends BaseActionColumn
7
{
8
    /**
9
     * @inheritdoc
10
     */
11
    protected function initDefaultButton($name, $iconName, $additionalOptions = [])
12
    {
13
        switch ($name) {
14
            case 'view':
15
                $buttonClass = 'btn-info';
16
                $iconName = 'info-sign';
17
                break;
18
            case 'delete':
19
                $buttonClass = 'btn-danger';
20
                break;
21
            default:
22
                $buttonClass = 'btn-primary';
23
        }
24
        return parent::initDefaultButton($name, $iconName, [
0 ignored issues
show
Are you sure the usage of parent::initDefaultButto...) + $additionalOptions) targeting yii\grid\ActionColumn::initDefaultButton() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
25
            'class' => ['btn', $buttonClass],
26
        ] + $additionalOptions);
27
    }
28
}
29