Class %s cannot extend final class %s

Description

A final class is a class that cannot be extended. This means any class that attempts to use extends on this class fails.

This error is produced both by userland code and PHP native code, such as Generator, etc.

Example

<?php

class X extends Generator {}

?>

Literal Examples

  • Class X cannot extend final class Generator

Solutions

  • Use composition on the final class, to include it in another class.