我最近将项目中的 Laravel 从 5.8.* 升级到了 6.x 版本。
现在,当我尝试运行 command 时composer dump-autoload -o
,出现此错误:
Declaration of App\Exceptions\Handler::renderHttpException(Symfony\Component\HttpKernel\Exception\HttpException $e)
should be compatible with Illuminate\Foundation\Exceptions\Handler::renderHttpException(Symfony\Component\HttpKern
el\Exception\HttpExceptionInterface $e)
下面是composer.json
项目中的设置,当我将 Laravel 从 5.7.* 升级到 5.8.* 时,我也遇到了与上面相同的错误,但我进一步升级希望能解决问题:
{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"repositories": [
{
"type": "composer",
"url": "https://packages.[company_api].com"
}
],
"require": {
"php": ">=7.1.3",
"basemkhirat/elasticsearch": "^1.3",
"botman/botman": "^2.5",
"botman/driver-web": "^1.5",
"deployer/deployer": "^6.0",
"fideloper/proxy": "^4.0",
"guzzlehttp/guzzle": "^6.3",
"jenssegers/agent": "^2.6",
"jimmiw/php-time-ago": "^2.0",
"laravel/framework": "^6.0",
"laravel/scout": "^8.0",
"laravel/tinker": "~1.0",
"[company_name]/wordpressblogapi": "1.4.*"
},
"require-dev": {
"filp/whoops": "~2.0",
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~7.0"
},
"autoload": {
"classmap": [
"database/seeds",
"database/factories"
],
"psr-4": {
"App\\": "app/"
},
"files": [
"helpers/helpers.php"
]
},
"autoload-dev": {
"psr-4": {
"Tests\\": "tests/"
}
},
"scripts": {
"post-root-package-install": [
"php -r \"file_exists('.env') || copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"@php artisan key:generate"
],
"post-autoload-dump": [
"Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
"@php artisan package:discover"
]
},
"config": {
"preferred-install": "dist",
"sort-packages": true,
"optimize-autoloader": true
}
}
我已经参考了文档,它没有具体说明任何Exception
或Handler.php
文件更改,所以任何人都建议如何解决这个问题......