Why is this an issue?

To reference the current class instance the keyword $this can be used. Through the use of this keyword you have access to class properties and methods.

Static methods can be accessed without instantiating the class, so $this is not available for them. Using $this in a static context will result in a runtime error.

How to fix it

Code examples

Noncompliant code example

class Clazz {
  public $name = NULL;  // instance variable

  public static function foo() {
    if ($this->name != NULL) {
      // ...
    }
  }
}

Compliant solution

class Clazz {
  public $name = NULL;  // instance variable

  public static function foo($nameParam) {
    if ($nameParam != NULL) {
      // ...
    }
  }
}

Resources

Documentation