Class %s cannot extend %s %s¶
Description¶
A class that is marked final cannot be extended. This error applies to a class that tries to use a final class as parent.
Example¶
<?php
final class X {}
class Y extends X {}
?>
Literal Examples¶
Class T cannot extend class X
Solutions¶
Remove the
finalkeyword on the parent class.Use composition in the intended child class.
Static Analysis¶
This error may be tracked down with the following static analysis rules: Classes/CantExtendFinal.