gpt4 book ai didi

php - Laravel 7 从 Laravel 6 升级时抛出错误 255

转载 作者:行者123 更新时间:2023-12-03 15:24:08 29 4
gpt4 key购买 nike

我只是尝试将 Laravel 从 v6 升级到 v7,我的 php 版本是 7.3,我升级了 Laravel 站点上所述的所有依赖项,并删除了冲突的包,升级似乎已完成,但出现以下错误:

Generating optimized autoload files> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi
PHP Fatal error: Declaration of App\Exceptions\Handler::report(Exception $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Throwable $e) in /var/www/html/virtuozzo-api/app/Exceptions/Handler.php on line 8
PHP Fatal error: Uncaught ReflectionException: Class App\Exceptions\Handler does not exist in /var/www/html/virtuozzo-api/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
Stack trace:
#0 /var/www/html/virtuozzo-api/vendor/laravel/framework/src/Illuminate/Container/Container.php(803): ReflectionClass->__construct('App\\Exceptions\\...')
#1 /var/www/html/virtuozzo-api/vendor/laravel/framework/src/Illuminate/Container/Container.php(681): Illuminate\Container\Container->build('App\\Exceptions\\...')
#2 /var/www/html/virtuozzo-api/vendor/laravel/framework/src/Illuminate/Foundation/Application.php(787): Illuminate\Container\Container->resolve('App\\Exceptions\\...', Array, false)
#3 /var/www/html/virtuozzo-api/vendor/laravel/framework/src/Illuminate/Container/Container.php(265): Illuminate\Foundation\Application->resolve('App\\Exceptions\\...', Array, false)
#4 /var/www/html/virtuozzo-api/vendor/laravel/framework/src/Illuminate/Container/Container.php(799): Illuminate\Container\Container->Illuminate\Container\{cl in /var/www/html/virtuozzo-api/vendor/laravel/framework/src/Illuminate/Container/Container.php on line 805
Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255

我已经尝试删除供应商文件夹并再次安装,也使用composer dump autoload,并尝试清除laravel缓存,但总是得到相同的错误。

最佳答案

在您的 app/Exceptions/Handler.php 文件:替换 Exception带有 Throwable 的类型提示类型提示。

Upgrade guide 中所述.

关于php - Laravel 7 从 Laravel 6 升级时抛出错误 255,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60527984/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com