Check out this example:
class ParentClass {
public function __construct() {
// Does not prevent using 'SomeObject' as constructor
}
}
class SomeObject extends ParentClass {
function SomeObject () {
// Should not use this as constructor
}
}
$obj = new SomeObject();
How can I prevent for each extending class to use the class name as the constructor? I've tried to set an empty __construct
, but it still calls the SomeObject-Method (what is actually logical).
Is there a way to disable it in the php.ini or in a similar way as I tried above? I googled about 2 hours but I couldn't find anything.
Greets