Please add new rule to disallow use self:: for non-static method calls ($this-> should be used instead).
Example:
class SomeClass
{
public function NonStaticMethod(): void
{
//do something
}
public function AnotherMethod(): void
{
$this->NonStaticMethod(); //normal way to call non-static methods
self::NonStaticMethod(); // This is where sniff should raise error
}
}
Using self:: to call non-static methods is formally acceptable in PHP, but is a marker of some leftovers after refactoring or just a bad design.
Thank you for the great product!
Please add new rule to disallow use
self::for non-static method calls ($this->should be used instead).Example:
Using
self::to call non-static methods is formally acceptable in PHP, but is a marker of some leftovers after refactoring or just a bad design.Thank you for the great product!