How can the use of final methods in the Exception class impact the creation of custom exception classes in PHP?

Using final methods in the Exception class can restrict the ability to override certain methods in custom exception classes. To work around this limitation, you can create a base custom exception class that extends the built-in Exception class and override the methods you need in the custom class instead.

class CustomException extends Exception {
    public function __construct($message = "", $code = 0, Throwable $previous = null) {
        parent::__construct($message, $code, $previous);
    }

    // Override any methods from the Exception class here
}