aedart/athenaeum

LaravelExceptionHandler::render() response violates interface

aedart opened this issue · 0 comments

Description

The \Aedart\Core\Exceptions\Handlers\Adaptors\LaravelExceptionHandler::render() method sets HTTP status code header and outputs given the given exception. This violates Laravel's ExceptionHandler interface.

Furthermore, phpstan also reports the following error:

LaravelExceptionHandler::render() should return Symfony\Component\HttpFoundation\Response but return statement is missing.  

Possible solution

For now, the phpstan error must be ignored, because either solution will break backwards compatibility and expected behavior of the exception handler adapter.

In the next major version, the core application can either import \Symfony\Component\HttpFoundation\Response (package required) and respect Laravel's interface, or we can overwrite the return type to never and stop further execution with exit.
Not too sure about what would be best...