src/Http/Message.php
public function withProtocolVersion($version)
    {
        if (!in_array((string)$version, $this->allowed_protocol_versions)) {
            throw new InvalidArgumentException(sprintf(
                'HTTP protocol version is invalid. Must be of : %s',
                implode(', ', $this->allowed_protocol_versions)
            ));
        }

        $message = clone $this;
        $message->protocol_version = (string)$version;

        return $message;
    }
public function withProtocolVersion($version)
    {
        if (!in_array((string)$version, $this->allowed_protocol_versions)) {
            throw new InvalidArgumentException(sprintf(
                'HTTP protocol version is invalid. Must be of : %s',
                implode(', ', $this->allowed_protocol_versions)
            ));
        }

        $message = clone $this;
        $message->protocol_version = (string)$version;

        return $message;
    }
Return an instance with the specified HTTP protocol version.
The version string MUST contain only the HTTP version number (e.g.,
"1.1", "1.0").
This method MUST be implemented in such a way as to retain the
immutability of the message, and MUST return an instance that has the
new protocol version.

@param string $version HTTP protocol version
@return MessageInterface
@throws InvalidArgumentException