<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

class ParentClass
{
public function __construct()
{
}
 public static function create() {
     return new static();
 }
public function testMethod()
{
echo "this should work in both classes ";
echo '<br>';
}
}
 
class ChildClass extends ParentClass
{
 public function __construct(string $param1 = 'test', string $param2)
{
}
}
 
 
$object1 = ParentClass::create();
$object1->testMethod();
$object2 = ChildClass::create();
$object2->testMethod();
