This rule is deprecated, and will eventually be removed.

Why is this an issue?

Shadowing occurs when a local variable has the same name as a variable or a field in an outer scope.

This can lead to three main problems:

To avoid these problems, rename the shadowing, shadowed, or both identifiers to accurately represent their purpose with unique and meaningful names.

This rule focuses on variables in methods that shadow a field.

Noncompliant code example

class Foo {
  public $myField;

  public function doSomething() {
    $myField = 0; // Noncompliant
    ...
  }
}