ToolErrors
in package
FinalYes
ツールのバリデーション/実行エラーを表す不変の型付きコレクション。
旧 Surfacer の public 可変プロパティ $this->Error(array<string,mixed>)を置き換える。
$this->Error['blod_name_input'] = true のようなキー typo(実際に混入したバグ)を、生成を
with に集約し不変にすることで検知しやすくする。detail は既定 true(フラグ)だが、
インポート失敗メッセージのように文字列を持たせることもできる(Twig 側で errors.seed_failed 参照)。
Table of Contents
Properties
- $items : array<string|int, mixed>
Methods
- __construct() : mixed
- all() : array<string, mixed>
- isEmpty() : bool
- keys() : array<int, string>
- merge() : self
- 別のコレクションを取り込んだ新しいインスタンスを返す(不変・同一キーは相手優先)。
- with() : self
- エラーを 1 件足した新しいインスタンスを返す(不変)。
Properties
$items read-only
private
array<string|int, mixed>
$items
= []
Methods
__construct()
public
__construct([array<string, mixed> $items = [] ]) : mixed
Parameters
- $items : array<string, mixed> = []
-
エラーキー → detail(true もしくはメッセージ文字列)
all()
public
all() : array<string, mixed>
Return values
array<string, mixed>isEmpty()
public
isEmpty() : bool
Return values
boolkeys()
public
keys() : array<int, string>
Return values
array<int, string>merge()
別のコレクションを取り込んだ新しいインスタンスを返す(不変・同一キーは相手優先)。
public
merge(self $other) : self
Parameters
- $other : self
Return values
selfwith()
エラーを 1 件足した新しいインスタンスを返す(不変)。
public
with(string $key[, mixed $detail = true ]) : self
Parameters
- $key : string
- $detail : mixed = true