this should work in both classes
Fatal error: Uncaught ArgumentCountError: Too few arguments to function ChildClass::__construct(), 0 passed in /home/ro35GN/prog.php on line 16 and exactly 2 expected in /home/ro35GN/prog.php:29
Stack trace:
#0 /home/ro35GN/prog.php(16): ChildClass->__construct()
#1 /home/ro35GN/prog.php(38): ParentClass::create()
#2 /home/ro35GN/prog.php(43): testClass(Object(ChildClass))
#3 {main}
thrown in /home/ro35GN/prog.php on line 29
PHP Fatal error: Uncaught ArgumentCountError: Too few arguments to function ChildClass::__construct(), 0 passed in /home/ro35GN/prog.php on line 16 and exactly 2 expected in /home/ro35GN/prog.php:29
Stack trace:
#0 /home/ro35GN/prog.php(16): ChildClass->__construct()
#1 /home/ro35GN/prog.php(38): ParentClass::create()
#2 /home/ro35GN/prog.php(43): testClass(Object(ChildClass))
#3 {main}
thrown in /home/ro35GN/prog.php on line 29