1818/**
1919 * Container for form controls.
2020 *
21- * @property ArrayHash $values
21+ * @property ArrayHash<mixed> $values
2222 * @property-read \Iterator $controls
23- * @property-read Form|null $form
23+ * @property-read ?Form $form
24+ * @implements \ArrayAccess<string|int, Nette\ComponentModel\IComponent>
2425 */
2526class Container extends Nette \ComponentModel \Container implements \ArrayAccess
2627{
@@ -30,12 +31,12 @@ class Container extends Nette\ComponentModel\Container implements \ArrayAccess
3031
3132 /**
3233 * Occurs when the form was validated
33- * @var array<callable(self, array |object): void| callable(array |object): void>
34+ * @var array<callable(self, mixed[] |object): void | callable(mixed[] |object): void>
3435 */
3536 public array $ onValidate = [];
3637 protected ?ControlGroup $ currentGroup = null ;
3738
38- /** @var callable[] extension methods */
39+ /** @var array<string, callable(self): mixed> */
3940 private static array $ extMethods = [];
4041 private ?bool $ validated = false ;
4142 private ?string $ mappedType = null ;
@@ -46,6 +47,7 @@ class Container extends Nette\ComponentModel\Container implements \ArrayAccess
4647
4748 /**
4849 * Fill-in with default values.
50+ * @param mixed[]|object $data
4951 */
5052 public function setDefaults (array |object $ data , bool $ erase = false ): static
5153 {
@@ -57,6 +59,7 @@ public function setDefaults(array|object $data, bool $erase = false): static
5759
5860 /**
5961 * Fill-in with values.
62+ * @param mixed[]|object $values
6063 * @internal
6164 */
6265 public function setValues (array |object $ values , bool $ erase = false , bool $ onlyDisabled = false ): static
@@ -83,7 +86,10 @@ public function setValues(array|object $values, bool $erase = false, bool $onlyD
8386
8487 /**
8588 * Returns the values submitted by the form.
86- * @param Control[]|null $controls
89+ * @template T of object
90+ * @param class-string<T>|T|'array'|true|null $returnType
91+ * @param ?list<Control> $controls
92+ * @return ($returnType is class-string<T>|T ? T : ($returnType is 'array'|true ? mixed[] : ArrayHash<mixed>))
8793 */
8894 public function getValues (string |object |bool |null $ returnType = null , ?array $ controls = null ): object |array
8995 {
@@ -121,7 +127,10 @@ public function getValues(string|object|bool|null $returnType = null, ?array $co
121127
122128 /**
123129 * Returns the potentially unvalidated values submitted by the form.
124- * @param Control[]|null $controls
130+ * @template T of object
131+ * @param class-string<T>|T|'array'|null $returnType
132+ * @param ?list<Control> $controls
133+ * @return ($returnType is class-string<T>|T ? T : ($returnType is 'array' ? mixed[] : ArrayHash<mixed>))
125134 */
126135 public function getUntrustedValues (string |object |null $ returnType = null , ?array $ controls = null ): object |array
127136 {
@@ -179,6 +188,7 @@ public function getUnsafeValues($returnType, ?array $controls = null)
179188 }
180189
181190
191+ /** @param class-string $type */
182192 public function setMappedType (string $ type ): static
183193 {
184194 $ this ->mappedType = $ type ;
@@ -237,6 +247,7 @@ public function validate(?array $controls = null): void
237247
238248 /**
239249 * Returns all validation errors.
250+ * @return string[]
240251 */
241252 public function getErrors (): array
242253 {
@@ -286,6 +297,7 @@ public function addComponent(
286297
287298 /**
288299 * Iterates over all form controls.
300+ * @return iterable<Control>
289301 */
290302 public function getControls (): \Iterator
291303 {
@@ -464,6 +476,7 @@ public function addCheckbox(string $name, string|Stringable|null $caption = null
464476
465477 /**
466478 * Adds set of radio button controls to the form.
479+ * @param ?mixed[] $items
467480 */
468481 public function addRadioList (
469482 string $ name ,
@@ -477,6 +490,7 @@ public function addRadioList(
477490
478491 /**
479492 * Adds set of checkbox controls to the form.
493+ * @param ?mixed[] $items
480494 */
481495 public function addCheckboxList (
482496 string $ name ,
@@ -490,6 +504,7 @@ public function addCheckboxList(
490504
491505 /**
492506 * Adds select box control that allows single item selection.
507+ * @param ?mixed[] $items
493508 */
494509 public function addSelect (
495510 string $ name ,
@@ -505,6 +520,7 @@ public function addSelect(
505520
506521 /**
507522 * Adds select box control that allows multiple item selection.
523+ * @param ?mixed[] $items
508524 */
509525 public function addMultiSelect (
510526 string $ name ,
@@ -578,6 +594,7 @@ public function addContainer(string|int $name): self
578594 /********************* extension methods ****************d*g**/
579595
580596
597+ /** @param mixed[] $args */
581598 public function __call (string $ name , array $ args )
582599 {
583600 if (isset (self ::$ extMethods [$ name ])) {
0 commit comments