ValueError

(PHP 8)

はじめに

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

クラス概要

class ValueError extends Error {
/* 継承したプロパティ */
protected string $message = "";
private string $string = "";
protected int $code;
protected string $file = "";
protected int $line;
private array $trace = [];
private ?Throwable $previous = null;
/* 継承したメソッド */
public function Error::__construct(string $message = "", int $code = 0, ?Throwable $previous = null)
final public function Error::getMessage(): string
final public function Error::getPrevious(): ?Throwable
final public function Error::getCode(): int
final public function Error::getFile(): string
final public function Error::getLine(): int
final public function Error::getTrace(): array
final public function Error::getTraceAsString(): string
public function Error::__toString(): string
private function Error::__clone(): void
}
add a note

User Contributed Notes

There are no user contributed notes for this page.
To Top