Detect class name usage inside that class declaration and suggest replacing it with self.
<?php
class TheExample
{
const EXAMPLE = 1;
public function createMe()
{
$instance = new TheExample();
$constant = TheExample::EXAMPLE;
}
}
Original idea came from Phabricator Xphast, where sniff was called Self Class Reference and in there only new ClassName constructs were checked. Error message was:
Use `self` to instantiate the current class.
Detect class name usage inside that class declaration and suggest replacing it with
self.Original idea came from Phabricator Xphast, where sniff was called
Self Class Referenceand in there onlynew ClassNameconstructs were checked. Error message was: