1.2.1388. Useless Method

This method is useless, as it actually does what PHP would do by default.

For example, relaying a method call to its parent is useless. Removing the method altogether has the same feature, although this doesn’t apply to constructors.

<?php

class y {
     function foo() {
             // doSomething('foo')
     }
     function goo() {
             // doSomething('goo')
     }
}

class x extends y {
     // No definition for goo(), so it fallback to the parent

     // This definition of foo() falls back to the parent's,
     // just like if it wasn't there.
     function foo() {
             return parent::foo();
     }
}
?>

1.2.1388.1. Suggestions

  • Remove the useless method

  • Add more code to the method body

1.2.1388.2. Specs

Short name

Classes/UselessMethod

Rulesets

All, Analyze

Exakat since

2.5.1

PHP Version

All

Severity

Minor

Time To Fix

Instant (5 mins)

Precision

High

Available in

Entreprise Edition, Exakat Cloud