Cannot use the final modifier on an abstract class

Description

The options final and abstract are mutually exclusive. The first one prevents any redefinition by children, while the second one requests an implementation, and as such, a redefinition, in children classes.

It is the same message, whatever the order of the options.

Example

<?php

final abstract class X {}

abstract final class Z {}

?>

Solutions

  • Drop the abstract option.

  • Drop the final option.

  • Drop both the options.

Changed Behavior

This error may appear following an evolution in behavior, in previous versions. See ` <https://php-changed-behaviors.readthedocs.io/en/latest/behavior/.html>`_.