« InternalIterator::valid
Throwable::getMessage »

Throwable

(PHP 7, PHP 8)

はじめに

Throwable は、throw 文でスロー可能なあらゆるオブジェクトが実装する基底インターフェイスです。 Error や Exception も、これを実装しています。

注意:

PHP のクラスが Throwable インターフェイスを直接実装することはできません。 そのかわりに、Exception を継承する必要があります。

インターフェイス概要

interface Throwable extends Stringable {
/* メソッド */
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
/* 継承したメソッド */
public function Stringable::__toString(): string
}

変更履歴

バージョン 説明
8.0.0 Throwable は、 Stringable を新たに実装しました。

目次

関連キーワード:
Throwable   インターフェイス   実装   getMessage   Stringable   toString   Exception   継承   getCode   getFile   getLine   getTrace   getTraceAsString   getPrevious   スタック   トレース   InternalIterator   valid   throw   基底   概要   interface   extends   履歴   目次
関連する関数・ページ:
throwable.getprevious   throwable.getfile   throwable.gettraceasstring   throwable.gettrace   throwable.getcode   class.error