protected function getConstructParameters(ReflectionClass $reflectionClass, array $data): array
    {
        $constructor = $reflectionClass->getConstructor();
        if ($constructor instanceof ReflectionMethod) {
            foreach ($constructor->getParameters() as $parameter) {
                $name = $parameter->getName();

                $class = $parameter->getClass();
                if ($class instanceof ReflectionClass) {
                    $value = $class->newInstanceArgs(
                        $this->getConstructParameters($class, $data[$name] ?? [])
                    );
                } elseif (array_key_exists($name, $data) === true) {
                    $value = $data[$name];
                } elseif ($parameter->isDefaultValueAvailable() === true) {
                    $value = $parameter->getDefaultValue();
                } elseif ($parameter->allowsNull() === true) {
                    $value = null;
                } else {
                    throw new MissingConstructParameter($parameter);
                }

                $parameters[$name] = $value;
            }
        }

        return $parameters ?? [];
    }