gpt4 book ai didi

php - Laravel:App\Providers\EventServiceProvider::boot 的声明

转载 作者:行者123 更新时间:2023-12-01 18:34:02 28 4
gpt4 key购买 nike

我目前正在更新到 Laravel 5.4,并在控制台中遇到以下错误。

Declaration of App\Providers\EventServiceProvider::boot(Illuminate\Contract
s\Events\Dispatcher $events) should be compatible with Illuminate\Foundatio
n\Support\Providers\EventServiceProvider::boot()

这是我的composer.json

{
"name": "laravel/laravel",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"type": "project",
"require": {
"php": ">=5.5.9",
"laravel/framework": "5.4.*",
"illuminate/html": "5.0.*",
"laravelcollective/html": "^5.4.0"
},
"require-dev": {
"fzaninotto/faker": "~1.4",
"mockery/mockery": "0.9.*",
"phpunit/phpunit": "~5.7",
"symfony/css-selector": "2.8.*|3.0.*",
"symfony/dom-crawler": "2.8.*|3.0.*"
},
"autoload": {
"classmap": [
"database"
],
"psr-4": {
"App\\": "app/"
}
},
"autoload-dev": {
"classmap": [
"tests/TestCase.php"
]
},
"scripts": {
"post-root-package-install": [
"php -r \"copy('.env.example', '.env');\""
],
"post-create-project-cmd": [
"php artisan key:generate"
],
"post-install-cmd": [
"php artisan clear-compiled",
"php artisan optimize"
],
"pre-update-cmd": [
"php artisan clear-compiled"
],
"post-update-cmd": [
"php artisan optimize"
]
},
"config": {
"preferred-install": "dist"
}
}

最佳答案

您将更新到 5.4,因此有些事情将会发生变化。

引导方法不再需要传递给它的参数,父方法也不需要:

从函数和 parent::boot() 中完全删除参数,这样就不会向其中任何一个传递参数:

public function boot() 
{
parent::boot();
}

关于php - Laravel:App\Providers\EventServiceProvider::boot 的声明,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/44788352/

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