Throwable

(PHP 7, PHP 8)

Introduction

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
abstract public __toString(): string
/* Inherited methods */
public Stringable::__toString(): string
}

Changelog

Version Description
8.0.0 Throwable implements Stringable now.

Table of Contents