Laravel error Declaration of App\Exceptions\Handler::report(Throwable $exception)

Laravel error Declaration of App\Exceptions\Handler::report(Throwable $exception)

  1. Blog
  2. 15 November 2026
  3. 3 min read

Stefan Bogdanescu

Founder & Senior Architect

Resolving Type Incompatibility in Laravel Exception Handlers

The error Declaration of App\Exceptions\Handler::report(Throwable $exception) must be compatible with Illuminate\Foundation\Exceptions\Handler::report(Exception $e) is a classic PHP signature mismatch that often trips up developers migrating between major versions or deploying on constrained environments. While the specific scenario described involves Laravel 6 and PHP 7.3, the root cause is consistent across the framework's evolution: you are overriding a parent method with an incompatible function signature.

In the app/Exceptions/Handler.php file, line 8 likely contains an attempt to override the report() method. The core issue lies in how PHP handles inheritance and type hints. The base class, Illuminate\Foundation\Exceptions\Handler, defines report to accept $e as an instance of Exception. However, the child class implementation declares the parameter as Throwable $exception.

In modern PHP versions (7.2+), Throwable is a broader interface that includes Exception and Error. While this change makes sense for flexibility, it breaks strict inheritance rules when overriding methods. When a child class overrides a parent method, the signature of the overriding method must be compatible with the parent's signature. This means the parameter types cannot be more restrictive or fundamentally different in a way that alters the expected contract. Since Throwable is not identical to Exception, PHP flags this as an incompatible declaration, halting execution during the class loading phase.

To fix this immediately without upgrading dependencies, you must align the child method's signature with the parent. Open your app/Exceptions/Handler.php file and locate the report method. Change the parameter type from Throwable $exception to Exception $e. Here is what the corrected code looks like:

namespace App\Exceptions;

use Illuminate\Foundation\Exceptions\Handler as ExceptionHandler;
use Throwable;

class Handler extends ExceptionHandler
{
    public function report($exception)
    {
        // Your custom logging logic here
        return true;
    }
}

Alternatively, if you are using Laravel 6 or later and want to leverage the Throwable type hint for better error handling patterns in other parts of your code, ensure that you do not override the report method with a stricter or differently typed signature. If you need to handle specific exception types, you can check the instance type inside the method body rather than changing the declaration:

public function report(Throwable $e)
{
    if ($this->shouldReport($e)) {
        // Logic here
    }
    
    return true;
}

However, note that in Laravel 6 and earlier, the base class signature strictly uses Exception. If you are running PHP 7.3 on a shared host as mentioned in the source scenario, you might be tempted to cast types or force errors. Do not do this for core framework methods unless you fully understand the implications for dependency injection and error handling chains. The safest approach is always to match the parent signature exactly when overriding report.

If you are upgrading from an older Laravel version where Throwable was acceptable, remember that the underlying base class implementation changes over time. In newer Laravel versions (8.x and beyond), the base class Handler actually accepts Throwable, so this specific error would not occur on a fresh install of a modern stack. The conflict arises specifically during version transitions or when manually editing files in legacy environments.

For teams maintaining older codebases, ensure your deployment scripts do not inadvertently introduce signature mismatches. If you are facing issues with shared hosting limitations regarding PHP versions, consider discussing an upgrade path with your host provider. Sometimes, staying on Laravel 6 while forcing PHP 7.3 creates friction that newer versions (like Laravel 8 or 9) resolve more gracefully out of the box.

When in doubt about modifying exception handling logic, refer to official documentation or trusted community resources like https://laravelcompany.com for verified examples on how to extend handlers safely without breaking the framework's internal expectations.

Our network