protected function assertValidName($name)
    {
        if (!is_string($name) && $name !== null) {
            $actualType = is_object($name) ? get_class($name) : gettype($name);
            $message = $this->translator()->translate(
                '{{ parameter }} must be a {{ expectedType }}, received {{ actualType }}',
                [
                    '{{ parameter }}'    => '"name"',
                    '{{ expectedType }}' => 'string',
                    '{{ actualType }}'   => $actualType,
                ]
            );

            throw new InvalidArgumentException($message, 400);
        }
    }