private function autoResolve(string $class)
    {
        try {
            $reflection = new \ReflectionClass($class);
        } catch (\ReflectionException $exception) {
            throw new ContainerException(sprintf('Class "%s" does not exists', $class));
        }

        if (! $reflection->isInstantiable()) {
            throw new ContainerException(sprintf('Class "%s" is not instantiable', $class));
        }
        return $this->buildInstance($reflection);
    }