6
votes

I'm currently updating to Laravel 5.4 and have encountered the following error in the console.

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

Here is my 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"
}
}
2
Are you following the Upgrade Guide here: laravel.com/docs/5.4/upgrade ? The Laravel docs generally outline the upgrade steps pretty well. Also, from what version of Laravel are you upgrading from?kjones

2 Answers

14
votes

You're updating to 5.4, so some things are going to change.

The boot method no longer requires an argument passed to it, nor does the parent:

Remove the argument completely from both the function, and the parent::boot() so no arguments are passed to either:

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

I think your application might be caching the compiled files, One solution worked for me after upgrading, is to recreate a fresh empty directory of:

bootstrap/cache

Rename the existing folder to different temp name, and create a new directory bootstrap/cache and apply the permissions/ownership , and you are good to go.