1.2.99. Can’t Extend Final

It is not possible to extend final classes.

Since PHP fails with a fatal error, this means that the extending class is probably not used in the rest of the code. Check for dead code. In a separate file :

<?php
    // File Foo
    final class foo {
        public final function bar() {
            // doSomething
        }
    }
?>

See also Final Keyword.

1.2.99.1. Suggestions

  • Remove the final keyword

  • Remove the extending class

1.2.99.2. Specs

Short name

Classes/CantExtendFinal

Rulesets

All, Analyze, Dead code, IsExt, IsPHP, IsStub

Exakat since

0.8.4

PHP Version

All

Severity

Critical

Time To Fix

Instant (5 mins)

Precision

Medium

Features

final

Available in

Entreprise Edition, Exakat Cloud