Issues (1313)

controllers/HomeController.php (1 issue)

Labels
Severity
1
<?php
2
3
namespace app\controllers;
4
5
use app\models\{Home, About, User};
6
use yii\filters\{AccessControl, VerbFilter};
7
use yii\helpers\ArrayHelper;
8
9
/**
10
 * Class HomeController
11
 *
12
 * @package app\controllers
13
 */
14
class HomeController extends BaseController
15
{
16
    /**
17
     * @return array
18
     */
19
    public function behaviors()
20
    {
21
        return ArrayHelper::merge(parent::behaviors(), [
22
            'access' => [
23
                'class' => AccessControl::class,
24
                'rules' => [
25
                    [
26
                        'allow' => true,
27
                        'actions' => ['index'],
28
                        'roles' => ['?', '@'],
29
                    ],
30
                ],
31
            ],
32
            'verbs' => [
33
                'class' => VerbFilter::class,
34
                'actions' => [
35
                    'index' => ['get'],
36
                ],
37
            ]
38
        ]);
39
    }
40
41
    /**
42
     * Displays homepage.
43
     *
44
     * @return string
45
     */
46
    public function actionIndex()
47
    {
48
        $model = Home::getDefaultHome();
49
50
        $this->setMetaParams($model);
0 ignored issues
show
It seems like $model can also be of type array; however, parameter $model of app\controllers\BaseController::setMetaParams() does only seem to accept null|yii\db\ActiveRecord, maybe add an additional type check? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

50
        $this->setMetaParams(/** @scrutinizer ignore-type */ $model);
Loading history...
51
52
        return $this->render('index', [
53
            'model' => $model,
54
            'about' => About::getDefaultAbout(),
55
            'team' => User::getPublicUsers()
56
        ]);
57
    }
58
}
59