public function setSeverity($severity)
    {
        if (in_array($severity, ['error', 'warning', 'info', null], true)) {
            $this->severity = $severity;
        } else {
            throw new InvalidArgumentException('The severity must be either "error", "warning", or "info".');
        }

        return $this;
    }
public function setSeverity($severity)
    {
        if (in_array($severity, ['error', 'warning', 'info', null], true)) {
            $this->severity = $severity;
        } else {
            throw new InvalidArgumentException('The severity must be either "error", "warning", or "info".');
        }

        return $this;
    }
public function setSeverity ( $ severity ) { if ( in_array ( $ severity , [ 'error' , 'warning' , 'info' , null ] , true ) ) { $ this -> severity = $ severity ; } else { throw new InvalidArgumentException ( 'The severity must be either "error", "warning", or "info".' ) ; } return $ this ; }
Set the error severity.

@param string|null $severity the error severity

@throws \InvalidArgumentException

@return $this
Set the error severity .