src/Viserio/Component/Http/Request.php
private function filterMethod(?string $method): string
    {
        if ($method === null) {
            return self::METHOD_GET;
        }

        if (! \preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method)) {
            throw new InvalidArgumentException(\sprintf(
                'Unsupported HTTP method [%s].',
                $method
            ));
        }

        return $method;
    }
private function filterMethod(?string $method): string
    {
        if ($method === null) {
            return self::METHOD_GET;
        }

        if (! \preg_match("/^[!#$%&'*+.^_`|~0-9a-z-]+$/i", $method)) {
            throw new InvalidArgumentException(\sprintf(
                'Unsupported HTTP method [%s].',
                $method
            ));
        }

        return $method;
    }
Validate the HTTP method.

@param null|string $method

@throws \Viserio\Component\Contract\Http\Exception\InvalidArgumentException on invalid HTTP method

@return string