Skip to content

Commit

Permalink
Must get field
Browse files Browse the repository at this point in the history
  • Loading branch information
asika32764 committed Jan 21, 2024
1 parent 3a1527c commit 0228268
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down

0 comments on commit 0228268

Please sign in to comment.