I have the following code:
abstract class AbstractParent {
function __construct($param) { print_r($param); }
public static function test() { return new self(1234); }
}
class SpecificClass extends AbstractParent {}
When I invoke SpecificClass::test()
, I am getting an error:
Fatal error: Cannot instantiate abstract class AbstractParent
So what I basically want is just to let AbstractParent
's test()
instantiate class where this test()
was called from (so, in my example, instantiate SpecificClass
).