This works:
abstract class WonderfulBaseClass
{
public function doStuff()
{
$this->doPart1();
$this->doPart2();
}
abstract protected function doPart1();
abstract protected function doPart2();
}
but this doesn't (IDE says "Cannot call abstract method doPart[...]"):
abstract class WonderfulBaseClass
{
public static function doStuff()
{
static::doPart1();
static::doPart2();
}
abstract protected static function doPart1();
abstract protected static function doPart2();
}
My thought was that extenders of the abstract base-class would still be forced to implement doPart1
and doPart2
so there shouldn't be a problem but I guess I have a fundamental misunderstanding going on.
Can someone explain why the first case is fine while the second seems to be problematic?
EDIT: changed self to static in the second part -> yields the same error message