Cannot override final %s::%s() with %s::%s()

Description

The final keyword prevents any child class to define the same constant or method.

Example

<?php

class X {
     final function foo() {}
}

class Y extends X {
     function foo() {}
}

?>

Literal Examples

  • Cannot override final x::foo() with y::foo()

Solutions

  • Remove the final option in the parent class.

  • Rename the non-final constant or method in the child class.