Self Member Reference

The self keyword must be lowercase.

Valid: Lowercase self used.

class Bar { public function baz() { <em>self</em>::foo(); } }

Invalid: Uppercase self used.

class Bar { public function baz() { <em>SELF</em>::foo(); } }
There must be no spaces before or after the double colon operator.

Valid: No spaces around the double colon operator.

class Bar { public function baz() { self<em></em>::<em></em>foo(); } }

Invalid: Spaces around double colon operator.

class Bar { public function baz() { self<em> </em>::<em> </em>foo(); } }
The self keyword must be used instead of the current class name.

Valid: Self used as reference.

class Foo { public function bar() {}

public function baz() { <em>self</em>::bar(); } }

Invalid: Local class name used as reference.

class <em>Foo</em> { public function bar() {}

public function baz() { <em>Foo</em>::bar(); } }