1.2.1293. Unused Methods

Those methods are never called.

They are probably dead code, unless they are called dynamically.

This analysis omits methods which are in a class that makes dynamical self calls : $this->$m(). That way, any method may be called.

This analysis omits methods which are overwritten by a child class. That way, they are considered to provide a default behavior.

<?php

class foo {
    public function used() {
        $this->used();
    }

    public function unused() {
        $this->used();
    }
}

class bar extends foo {
    public function some() {
        $this->used();
    }
}

$a = new foo();
$a->used();

?>

See also Dead Code: Unused Method.

1.2.1293.1. Suggestions

  • Make use of the method

  • Remove the method

  • Move the method to another class

1.2.1293.2. Specs

Short name

Classes/UnusedMethods

Rulesets

All, Changed Behavior, Dead code

Exakat since

0.8.4

PHP Version

All

Severity

Minor

Time To Fix

Slow (1 hour)

Precision

Very high

Features

method

Related rule

Unused Public Methods

Available in

Entreprise Edition, Exakat Cloud