$className */ public function create(string $className) : Command { $commandReflectionClass = new ReflectionClass($className); $command = $commandReflectionClass->newInstanceWithoutConstructor(); $parentClassReflection = $commandReflectionClass->getParentClass(); if (!$parentClassReflection instanceof ReflectionClass) { throw new ParallelShouldNotHappenException(); } $parentConstructorReflectionMethod = $parentClassReflection->getConstructor(); if (!$parentConstructorReflectionMethod instanceof ReflectionMethod) { throw new ParallelShouldNotHappenException(); } $parentConstructorReflectionMethod->invoke($command); return $command; } }