protected function useKey(string $key, $value = null) : string
    {
        if ($value !== null && $this->isValidType($value) === false) {
            throw new \InvalidArgumentException($this->messageInvalidValue);
        }

        return (($value === null) ? $key : $value->getName());
    }