Error:
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover
PHP Fatal error: Declaration of App\Exceptions\Handler::report(Exception $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Throwable $e) in C:\xampp\htdocs\webdevforum\app\Exceptions\Handler.php on line 33
PHP Fatal error: Uncaught ReflectionException: Class "App\Exceptions\Handler" does not exist in C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php:912
Stack trace:
#0 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(912): ReflectionClass->__construct('App\\Exceptions\\...')
#1 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(795): Illuminate\Container\Container->build('App\\Exceptions\\...')
#2 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(961): Illuminate\Container\Container->resolve('App\\Exceptions\\...', Array, false)
#3 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(296): Illuminate\Foundation\Application->resolve('App\\Exceptions\\...', Array, false)
#4 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(908): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminate\Foundation\Application), Array)
#5 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(795): Illuminate\Container\Container->build(Object(Closure))
#6 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(961): Illuminate\Container\Container->resolve('Illuminate\\Cont...', Array, true)
#7 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(731): Illuminate\Foundation\Application->resolve('Illuminate\\Cont...', Array)
#8 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(946): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#9 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(288): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#10 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(207): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler()
#11 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(189): Illuminate\Foundation\Bootstrap\HandleExceptions->renderForConsole(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#12 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(231): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#13 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(255): Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#14 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()
#15 {main}
Next Illuminate\Contracts\Container\BindingResolutionException: Target class [App\Exceptions\Handler] does not exist. in C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php:914
Stack trace:
#0 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(795): Illuminate\Container\Container->build('App\\Exceptions\\...')
#1 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(961): Illuminate\Container\Container->resolve('App\\Exceptions\\...', Array, false)
#2 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(296): Illuminate\Foundation\Application->resolve('App\\Exceptions\\...', Array, false)
#3 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(908): Illuminate\Container\Container->Illuminate\Container\{closure}(Object(Illuminate\Foundation\Application), Array)
#4 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(795): Illuminate\Container\Container->build(Object(Closure))
#5 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(961): Illuminate\Container\Container->resolve('Illuminate\\Cont...', Array, true)
#6 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php(731): Illuminate\Foundation\Application->resolve('Illuminate\\Cont...', Array)
#7 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(946): Illuminate\Container\Container->make('Illuminate\\Cont...', Array)
#8 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(288): Illuminate\Foundation\Application->make('Illuminate\\Cont...')
#9 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(207): Illuminate\Foundation\Bootstrap\HandleExceptions->getExceptionHandler()
#10 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(189): Illuminate\Foundation\Bootstrap\HandleExceptions->renderForConsole(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#11 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(231): Illuminate\Foundation\Bootstrap\HandleExceptions->handleException(Object(Symfony\Component\ErrorHandler\Error\FatalError))
#12 C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Foundation\Bootstrap\HandleExceptions.php(255): Illuminate\Foundation\Bootstrap\HandleExceptions->handleShutdown()
#13 [internal function]: Illuminate\Foundation\Bootstrap\HandleExceptions->Illuminate\Foundation\Bootstrap\{closure}()
#14 {main}
thrown in C:\xampp\htdocs\webdevforum\vendor\laravel\framework\src\Illuminate\Container\Container.php on line 914
Script @php artisan package:discover handling the post-autoload-dump event returned with error code 255
Solution: Update the Handler
Class
To fix this issue, you need to update the method signature in your App\Exceptions\Handler
class.
1. Open the Handler.php
File
Navigate to app/Exceptions/Handler.php
.
2. Update the report
Method Signature
Replace:
public function report(Exception $exception)
{
// Your existing code
}
With:
use Throwable;
public function report(Throwable $exception)
{
// Your existing code
}
3. Update the render
Method Signature
If your render
the method also accepts an Exception
, you’ll need to update it as well:
Replace:
public function render($request, Exception $exception)
{
// Your existing code
}
With:
public function render($request, Throwable $exception)
{
// Your existing code
}