Laravel错误声明App \ Exceptions \ Handler :: report(Throwable $ exception) [英] Laravel error Declaration of App\Exceptions\Handler::report(Throwable $exception)

查看:255
本文介绍了Laravel错误声明App \ Exceptions \ Handler :: report(Throwable $ exception)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Laravel 6,并在将其部署到运行PHP 7.3的共享主机时出现以下错误:

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

App\Exceptions\Handler::report(Throwable $exception)

App \ Exceptions \ Handler :: report(Throwable $ exception)声明必须与/home/kb2hm3y8r4wm/public_html/laravel.supremeanimation.com中的Illuminate \ Foundation \ Exceptions \ Handler :: report(Exception $ e)兼容/app/Exceptions/Handler.php在第8行

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

推荐答案

我认为您收到的错误是由于Laravel 7(而非6)上的更改所致,正如您在

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:

  • 对于Laravel<7:

  • For Laravel < 7:

应用程序的报告和呈现方法 App \ Exceptions \ Handler 类应接受的实例 Exception 接口而不是 Throwable 实例:

The report and render methods of your application's App\Exceptions\Handler 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);

  • 对于Laravel> = 7:

  • For Laravel >= 7:

    应用程序的报告和呈现方法 App \ Exceptions \ Handler 类应接受的实例 Throwable 接口,而不是 Exception 实例:

    The report and render methods of your application's App\Exceptions\Handler 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);
    

  • 这篇关于Laravel错误声明App \ Exceptions \ Handler :: report(Throwable $ exception)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    相关文章
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆