protected function createInstance(string $name, int $useStoredDependencies)
    {
        $name = $this->getDefinitiveName($name);

        if (interface_exists($name)) {
            throw new ContainerException(sprintf(
                "Cannot create instance for interface `%s`.",
                $name
            ));
        }

        try {
            $dependencies = $this->getDependenciesFor($name, $useStoredDependencies);
        } catch (Throwable $e) {
            throw new ContainerException($e->getMessage());
        }

        return new $name(...$dependencies);
    }