public function validate(string $key, DescriptorInterface $descriptor)
    {
        $this->validateKey($key);
        $definition = $this->definitions[$key];

        if (get_class($descriptor) !== $definition->getClass()) {
            throw new \InvalidArgumentException(sprintf(
                'Descriptor with key "%s" must be of class "%s", got "%s"',
                $key,
                $definition->getClass(),
                get_class($descriptor)
            ));
        }
    }