Skip to content
Advertisement

Laravel error Declaration of AppExceptionsHandler::report(Throwable $exception) [closed]

I’m using Laravel 6 and getting the following error when deploying to a shared host running PHP 7.3:

AppExceptionsHandler::report(Throwable $exception)

Declaration of AppExceptionsHandler::report(Throwable $exception) must be compatible with IlluminateFoundationExceptionsHandler::report(Exception $e) in /home/kb2hm3y8r4wm/public_html/laravel.supremeanimation.com/app/Exceptions/Handler.php on line 8

Advertisement

Answer

I think the error you’re getting is due to changes on Laravel 7 (not 6), as you can see on Laravel 7 upgrade guide. Check this:

  • For Laravel < 7:

    The report and render methods of your application’s AppExceptionsHandler class should accept instances of the Exception interface instead of Throwable instances:

    use Exception;
    
    public function report(Exception $exception);
    public function render($request, Exception $exception);
    
  • For Laravel >= 7:

    The report and render methods of your application’s AppExceptionsHandler class should accept instances of the Throwable interface instead of Exception instances:

    use Throwable;
    
    public function report(Throwable $exception);
    public function render($request, Throwable $exception);
    
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement