A method is called on the own class that it does not declare

tx0/php:undefined-method-on-thisdefaulterrorreliability/api-misusedepth fastbug

What it finds

A method is called on the own class that it does not declare

Example from the rule's tests
<?phpclass Mailer{    public function send($to)    {        $this->validate($to);        $this->sendd($to);tx0 reports: the class has no method sendd        return self::format($to);    }     private function validate($to) {}     private static function format($to)    {        return $to;    }} class Child extends BaseMailer{    public function run()    {        $this->inherited();    }} abstract class Base{    public function run()    {        $this->step();    }} class Magic{    public function run()    {        $this->anything();    }     public function __call($name, $args) {}}
Highlighted lines are the ones tx0 reports, with its message under each; the other lines are left alone.

Turn it on, off or suppress it

The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:

tx0.toml
[rules]
"tx0/php:undefined-method-on-this" = "off"

To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:

// tx0: ignore[tx0/php:undefined-method-on-this] reason="..."

tx0 explain tx0/php:undefined-method-on-this shows the same in the terminal. Found a false positive? Report it.