PHP Conference Japan 2024

DateInvalidOperationException 類別

(PHP 8 >= 8.3.0)

簡介

當嘗試執行不支援的操作時,由 DateTimeImmutable::sub()DateTime::sub() 拋出。

此類不支援的操作的一個例子是使用表示相對時間規格的 DateInterval 物件,例如 next weekday,因為無法建構邏輯反轉的陳述式。

類別概要

class DateInvalidOperationException extends DateException {
/* 繼承的屬性 */
protected string $message = "";
私有 字串 $string = "";
保護 整數 $code;
保護 字串 $file = "";
保護 整數 $line;
私有 陣列 $trace = [];
私有 ?Throwable $previous = null;
/* 繼承的方法 */
公開 Exception::__construct(字串 $message = "", 整數 $code = 0, ?Throwable $previous = null)
最終 公開 Exception::getMessage(): 字串
最終 公開 Exception::getCode(): 整數
最終 公開 Exception::getFile(): 字串
最終 公開 Exception::getLine(): 整數
最終 公開 Exception::getTrace(): 陣列
}
新增註記

使用者貢獻的註記

此頁面沒有使用者貢獻的註記。
To Top