Cannot make non static method %s::%s() static in class %s

Description

Once a method has been defined, the static keyword, or its absence, must be preserved for the same method in the children classes.

Example

<?php

class X {
    function foo() {}
}

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

?>

Literal Examples

  • Cannot make non static method X::foo() static in class Y

Solutions

  • Add the static keyword to the method in the parent class.

  • Remove the static keyword in all eponymous methods in the children class.

  • Rename some of the methods to avoid a static conflict.