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 function getMessage(): string
public function getCode(): int
public function getFile(): string
public function getLine(): int
public function getTrace(): array
public function getTraceAsString(): string
public function getPrevious(): ?Throwable
public function __toString(): string
/* Inherited methods */
public function Stringable::__toString(): string
}

Changelog

Version Description
8.0.0 Throwable implements Stringable now.

Table of Contents