maxbeckers/amazon-alexa-php

Handle Session Ended Request - Allow null as a return value in AbstractRequestHandler::handleRequest?

fabeat opened this issue · 1 comments

According to the Amazon documentation, a SessionEndedRequest may not get a response.

In this library however, a RequestHandler must return a Response Object (see AbstractRequestHandler::handleRequest).

Should we allow AbstractRequestHandler::handleRequest to return null or create an EmptyResponse class that returns NULL when it is serialized to JSON?

Or do you have another idea?

I think it's better to allow AbstractRequestHandler::handleRequest to return null. Then you don't have an EmptyResponse Object, without any usage. When we don't need a Response in this case, then we should return a null response. And I think we shoud describe in phpdoc in which case the response makes sence to be null.