1.2.1298. Unused Public Methods

This rule lists unused public methods.

Unused public methods are declared as public in the class, but never called, including outside the class.

<?php

class x {
     public function usedMethod() {}

     // There is no call to this method
     public function unusedMethod() {}
}

$x = new x();
$x->usedMethod();


?>

1.2.1298.1. Specs

Short name

Classes/UnusedPublicMethod

Rulesets

All, Analyze, Changed Behavior

Exakat since

2.4.9

PHP Version

All

Severity

Minor

Time To Fix

Slow (1 hour)

Precision

Medium

Features

public, method

Related rule

Unused Private Methods, Unused Protected Methods, Unused Methods

Available in

Entreprise Edition, Exakat Cloud