diff --git a/src/Form.php b/src/Form.php index 0a0ca0d..4b04ed1 100644 --- a/src/Form.php +++ b/src/Form.php @@ -310,6 +310,12 @@ public function getField(string $namespace): ?AbstractField return $this->fields[$namespace] ?? null; } + public function mustGetField(string $namespace): AbstractField + { + return $this->getField($namespace) + ?? throw new \OutOfBoundsException("Field \"$namespace\" not exists."); + } + public function hasField(string $namespace): bool { return isset($this->fields[$namespace]);