Skip to content

"Using $this outside a class" in views templates #351

@Wirone

Description

@Wirone

In Yii2 templates, like this:

<?php

/* @var $this yii\web\View */
/* @var $form yii\bootstrap\ActiveForm */
/* @var $model App\Model\Foo */

echo $this->title;

PHPStan displays error about "Using $this outside a class".

Is there a way to fix this without fully ignoring this error message? Like disabling rule for specified directory?

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions