Throwable

(PHP 7, PHP 8)

Introducción

Throwable es la interfaz base para cualquier objeto que pueda ser lanzado mediante una sentencia throw, incluyendo Error y Exception.

Nota:

Las clases de PHP no pueden implementar la interfaz Throwable directamente, por lo que deben extender en su lugar Exception.

Sinopsis de la Interfaz

interface Throwable extends Stringable {
/* Métodos */
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
/* Métodos heredados */
public function Stringable::__toString(): string
}

Historial de cambios

Versión Descripción
8.0.0 Throwable implementa Stringable ahora.

Tabla de contenidos