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)
            ));
        }
    }
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)
            ));
        }
    }
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 ) ) ) ; } }
Validate the descriptor key AND ensures that the given
descriptor is of the correct type according to the schema.

This is called when a descriptor is set on the description.
Validate the descriptor key AND ensures that the given descriptor is of the correct type according to the schema .