So you can't make an abstract static function in php.
The alternatives as I see them are to:
Make the function non-static and write extra boilerplate code to create and store the object so I can access that function.
abstract class Foo { abstract public function bar(); } abstract class Good { public function bar() { ... } } // boilerplate to access Good->bar()... potentially a lot in multiple files $g = new Good(); $g->bar();
Fill in the static function in my abstract class with a BadMethodCallException, so that any call to a child class which doesn't implement it will throw the exception.
abstract class Foo { public static function bar() { throw new BadMethodCallException("Not Implemented By Child Class :("); } } class Good extends Foo { public static function bar() { // ... } } class Bad extends Foo { // no bar implementation } Good::bar(); // works Bad::bar(): // exception
I'm leaning towards 2. but was wondering if there's any community consensus on this issue or best practices.