3v4l.org

run code in 150+ php & hhvm versions
Bugs & Features
<?php abstract class HiddenFactory { protected function __construct() { } final protected static function create() { return new static(); } } class B extends HiddenFactory {} class C extends B { public static function create() { return new static(); } } class A extends HiddenFactory { protected static $recordClass = 'B'; final public static function createB() { $rc = static::$recordClass; return $rc::create(); } } class D extends A { protected static $recordClass = 'C'; } echo get_class(A::createB()); echo get_class(D::createB()); echo get_class(C::create());
Output for 5.3.0 - 5.4.21
Fatal error: Cannot override final method HiddenFactory::create() in /in/YhZrD on line 24
Process exited with code 255.