File tree Expand file tree Collapse file tree 11 files changed +18
-5
lines changed Expand file tree Collapse file tree 11 files changed +18
-5
lines changed Original file line number Diff line number Diff line change 1212
1313/**
1414 * Defines method that must be implemented to allow a component to act like a form control.
15+ * @template T
1516 */
1617interface Control
1718{
1819 /**
1920 * Sets control's value.
20- * @param mixed $value
21+ * @param T|null $value
2122 */
2223 function setValue (mixed $ value ): static ;
2324
2425 /**
2526 * Returns control's value.
26- * @return mixed
27+ * @return T|null
2728 */
2829 function getValue (): mixed ;
2930
Original file line number Diff line number Diff line change 3636 * @property-read array $errors
3737 * @property-read array $options
3838 * @property-read string $error
39+ *
40+ * @template T
41+ * @implements Control<T>
3942 */
4043abstract class BaseControl extends Nette \ComponentModel \Component implements Control
4144{
@@ -152,7 +155,6 @@ public function setValue($value): static
152155
153156 /**
154157 * Returns control's value.
155- * @return mixed
156158 */
157159 public function getValue (): mixed
158160 {
Original file line number Diff line number Diff line change 1515
1616/**
1717 * Push button control with no default behavior.
18+ * @extends BaseControl<string>
1819 */
1920class Button extends BaseControl
2021{
Original file line number Diff line number Diff line change 1616
1717/**
1818 * Check box control. Allows the user to select a true or false condition.
19+ * @extends BaseControl<bool>
1920 */
2021class Checkbox extends BaseControl
2122{
Original file line number Diff line number Diff line change 1717 *
1818 * @property array $items
1919 * @property-read mixed $selectedItem
20+ *
21+ * @extends BaseControl<array-key>
2022 */
2123abstract class ChoiceControl extends BaseControl
2224{
@@ -68,7 +70,6 @@ public function setValue($value): static
6870
6971 /**
7072 * Returns selected key.
71- * @return string|int|null
7273 */
7374 public function getValue (): mixed
7475 {
Original file line number Diff line number Diff line change 1616
1717/**
1818 * CSRF protection field.
19+ * @extends BaseControl<null>
1920 */
2021class CsrfProtection extends HiddenField
2122{
Original file line number Diff line number Diff line change 1616
1717/**
1818 * Hidden form control used to store a non-displayed value.
19+ * @extends BaseControl<string>
1920 */
2021class HiddenField extends BaseControl
2122{
Original file line number Diff line number Diff line change 1212
1313/**
1414 * Submittable image button form control.
15+ * @method array|null getValue()
1516 */
1617class ImageButton extends SubmitButton
1718{
Original file line number Diff line number Diff line change 1717 *
1818 * @property array $items
1919 * @property-read array $selectedItems
20+ *
21+ * @extends BaseControl<array-key[]>
2022 */
2123abstract class MultiChoiceControl extends BaseControl
2224{
@@ -82,6 +84,7 @@ public function setValue($values): static
8284
8385 /**
8486 * Returns selected keys.
87+ * @return array-key[]
8588 */
8689 public function getValue (): array
8790 {
Original file line number Diff line number Diff line change 1717
1818/**
1919 * Implements the basic functionality common to text input controls.
20+ * @extends BaseControl<string>
2021 */
2122abstract class TextBase extends BaseControl
2223{
@@ -48,7 +49,6 @@ public function setValue($value): static
4849
4950 /**
5051 * Returns control's value.
51- * @return mixed
5252 */
5353 public function getValue (): mixed
5454 {
You can’t perform that action at this time.
0 commit comments