MIR0001
InvalidScope
$this is used in a context where it is not available: either outside any class, or inside a static method where no object instance exists.
Example
Section titled “Example”<?phpclass Counter { private int $count = 0;
public static function reset(): void { $this->count = 0; // $this is not available in a static method }}How to fix
Section titled “How to fix”Remove the use of $this, change the method to non-static, or use a static property instead.
<?phpclass Counter { private static int $count = 0;
public static function reset(): void { self::$count = 0; }}