1.2.479. Forgotten Interface

The following classes have been found implementing an interface’s methods, though it doesn’t explicitly implements this interface. This may have been forgotten.

<?php

interface i {
    function i();
}

// i is not implemented and declared
class foo {
    function i() {}
    function j() {}
}

// i is implemented and declared
class foo implements i {
    function i() {}
    function j() {}
}

?>

See also Could Use Trait.

1.2.479.1. Connex PHP features

1.2.479.1.1. Suggestions

  • Mention interfaces explicitly whenever possible

1.2.479.1.2. Specs

Short name

Interfaces/CouldUseInterface

Rulesets

All, Analyze, Changed Behavior

Exakat since

0.11.7

PHP Version

All

Severity

Minor

Time To Fix

Quick (30 mins)

Precision

High

Available in

Entreprise Edition, Exakat Cloud