public function setMessage($message)
    {
        if ($message === null) {
            $this->message = null;
        } elseif (is_scalar($message) || method_exists($message, '__toString')) {
            $this->message = (string) $message;
        } else {
            throw new InvalidArgumentException('The message must be a string.');
        }

        return $this;
    }
public function setMessage($message)
    {
        if ($message === null) {
            $this->message = null;
        } elseif (is_scalar($message) || method_exists($message, '__toString')) {
            $this->message = (string) $message;
        } else {
            throw new InvalidArgumentException('The message must be a string.');
        }

        return $this;
    }
public function setMessage ( $ message ) { if ( $ message === null ) { $ this -> message = null ; } elseif ( is_scalar ( $ message ) || method_exists ( $ message , '__toString' ) ) { $ this -> message = ( string ) $ message ; } else { throw new InvalidArgumentException ( 'The message must be a string.' ) ; } return $ this ; }
Set the error message.

@param string|null $message the error message

@throws \InvalidArgumentException

@return $this
Set the error message .