Framework: PHP Fatal error: Declaration of App\Exceptions\Handler::report(Exception $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Throwable $e)

Created on 2 Mar 2020  路  6Comments  路  Source: laravel/framework

  • Laravel Version: 7.0
  • PHP Version: 7.3.5
  • Database Driver & Version: 10.1.40-MariaDB

Description: Getting error while upgrading from laravel 6.x to Laravel 7.0

Steps To Reproduce:

  1. Change "laravel/framework" to "^7.0" in composer.json
  2. Change "facade/ignition" to "^2.0" in composer.json
  3. Change "laravel/ui" to "~2.0" in composer.json
  4. Change "nunomaduro/collision" to "^4.1" in composer.json
  5. Run command composer update in cmd

Gets Error

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 D:\xampp\htdocs\bookster\webapp\Exceptions\Handler.php on line 8
PHP Fatal error: Uncaught ReflectionException: Class App\Exceptions\Handler does not exist in D:\xampp\htdocs\bookster\web\vendor\laravel\framework\src\Illuminate\Container\Container.php:803
Stack trace:

0 D:\xampp\htdocs\bookster\web\vendor\laravel\framework\src\Illuminate\Container\Container.php(803): ReflectionClass->__construct('App\Exceptions\...')

1 D:\xampp\htdocs\bookster\web\vendor\laravel\framework\src\Illuminate\Container\Container.php(681): Illuminate\Container\Container->build('App\Exceptions\...')

2 D:\xampp\htdocs\bookster\web\vendor\laravel\framework\src\Illuminate\FoundationApplication.php(787): Illuminate\Container\Container->resolve('App\Exceptions\...', Array, false)

3 D:\xampp\htdocs\bookster\web\vendor\laravel\framework\src\Illuminate\Container\Container.php(265): Illuminate\FoundationApplication->resolve('App\Exceptions\...', Array, false)

4 D:\xampp\htdocs\bookster\web\vendor\laravel\framework\src\Illuminate\Container\Container.php(799): Illuminate\Container\Container->Illuminate\Contain in D:\xampp\htdocs\bookster\web\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

I am also attaching my composer.json and composer.lock file

composer_json_and_composer_lock_file.zip

Most helpful comment

if you not changed anything in the handler. copy paste this file:

https://github.com/laravel/laravel/blob/master/app/Exceptions/Handler.php

All 6 comments

Please follow the upgrading guide.

if you not changed anything in the handler. copy paste this file:

https://github.com/laravel/laravel/blob/master/app/Exceptions/Handler.php

I'm not using laravel. I still have an 5 years old application in my dead repository. Sad.

@spelbreker It was missing the Exceptions folder and also the Handler.php file.
After created these worked pretty well.
Thanks a lot!

Thanks @spelbreker worked for me too.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jackmu95 picture jackmu95  路  3Comments

Anahkiasen picture Anahkiasen  路  3Comments

YannPl picture YannPl  路  3Comments

SachinAgarwal1337 picture SachinAgarwal1337  路  3Comments

klimentLambevski picture klimentLambevski  路  3Comments