src/Http/Message/MessageTrait.php
private function validateProtocolVersion($version): void
    {
        if (empty($version)) {
            throw new \InvalidArgumentException(
                'HTTP protocol version can not be empty'
            );
        }
        if (!\is_string($version)) {
            throw new \InvalidArgumentException(sprintf(
                'Unsupported HTTP protocol version; must be a string, received %s',
                (\is_object($version) ? \get_class($version) : \gettype($version))
            ));
        }

        // HTTP/1 uses a "<major>.<minor>" numbering scheme to indicate
        // versions of the protocol, while HTTP/2 does not.
        if (!\preg_match('#^(1\.[01]|2)$#', $version)) {
            throw new \InvalidArgumentException(\sprintf(
                'Unsupported HTTP protocol version "%s" provided',
                $version
            ));
        }
    }
private function validateProtocolVersion($version): void
    {
        if (empty($version)) {
            throw new \InvalidArgumentException(
                'HTTP protocol version can not be empty'
            );
        }
        if (!\is_string($version)) {
            throw new \InvalidArgumentException(sprintf(
                'Unsupported HTTP protocol version; must be a string, received %s',
                (\is_object($version) ? \get_class($version) : \gettype($version))
            ));
        }

        // HTTP/1 uses a "<major>.<minor>" numbering scheme to indicate
        // versions of the protocol, while HTTP/2 does not.
        if (!\preg_match('#^(1\.[01]|2)$#', $version)) {
            throw new \InvalidArgumentException(\sprintf(
                'Unsupported HTTP protocol version "%s" provided',
                $version
            ));
        }
    }
private function validateProtocolVersion ( $ version ) : void { if ( empty ( $ version ) ) { throw new \ InvalidArgumentException ( 'HTTP protocol version can not be empty' ) ; } if ( ! \ is_string ( $ version ) ) { throw new \ InvalidArgumentException ( sprintf ( 'Unsupported HTTP protocol version; must be a string, received %s' , ( \ is_object ( $ version ) ? \ get_class ( $ version ) : \ gettype ( $ version ) ) ) ) ; } // HTTP/1 uses a "<major>.<minor>" numbering scheme to indicate // versions of the protocol, while HTTP/2 does not. if ( ! \ preg_match ( '#^(1\.[01]|2)$#' , $ version ) ) { throw new \ InvalidArgumentException ( \ sprintf ( 'Unsupported HTTP protocol version "%s" provided' , $ version ) ) ; } }
Validate the HTTP protocol version

@param string $version

@throws \InvalidArgumentException on invalid HTTP protocol version
Validate the HTTP protocol version