ValueError

(PHP 8)

はじめに

ValueError は、 引数の型は正しいものの、値が正しくない場合にスローされます。 たとえば、関数は正の整数を期待しているのに負の値を渡したり、 空でない文字列/配列を期待しているのに空の値を渡したりした場合です。

クラス概要

classValueErrorextendsError {
protectedstring$message = "";
privatestring$string = "";
protectedint$code;
protectedstring$file = "";
protectedint$line;
privatearray$trace = [];
private?Throwable$previous = null;
publicError::__construct(string$message = "", int$code = 0, ?Throwable$previous = null)
finalpublicError::getCode(): int
finalpublicError::getFile(): string
finalpublicError::getLine(): int
finalpublicError::getTrace(): array
}
To Top