Can’t inherit abstract function %s::%s() (previously declared abstract in %s)¶
Description¶
In PHP 7.0 and 7.1, it was not possible to inherit an abstract class. In PHP 7.2, it was made possible.
Example¶
<?php
abstract class A { abstract function bar(stdClass $x); }
abstract class B extends A { abstract function bar($x): stdClass; }
// Fatal error: Can't inherit abstract function A::bar()
?>
Literal Examples¶
Can't inherit abstract function B::bar() (previously declared abstract in A)
Solutions¶
Upgrade to PHP 7.2 or later.
Remove the
abstract
keyword.Remove the method.