php / 8.1.5 / class.throwable.html /

Throwable

Introduction

(PHP 7, PHP 8)

Throwable is the base interface for any object that can be thrown via a throw statement, including Error and Exception.

Note:

PHP classes cannot implement the Throwable interface directly, and must instead extend Exception.

Interface synopsis

interface Throwable extends Stringable {
/* Methods */
public getMessage(): string
public getCode(): int
public getFile(): string
public getLine(): int
public getTrace(): array
public getTraceAsString(): string
public getPrevious(): ?Throwable
abstract public __toString(): string
/* Inherited methods */
public Stringable::__toString(): string
}

Changelog

Version Description
8.0.0 Throwable implements Stringable now.

Table of Contents

© 1997–2021 The PHP Documentation Group
Licensed under the Creative Commons Attribution License v3.0 or later.
https://www.php.net/manual/en/class.throwable.php