From 09e74d87407571afcbb3afac8a596d34f82f0dd8 Mon Sep 17 00:00:00 2001 From: Ahmed Hamouda Date: Fri, 26 Jun 2026 10:43:41 +0200 Subject: [PATCH 1/2] refine input method contracts in UI component interfaces --- components/ILIAS/UI/src/Component/Component.php | 2 +- .../ILIAS/UI/src/Component/Input/Field/Numeric.php | 9 +++++++++ components/ILIAS/UI/src/Component/Input/Input.php | 11 +++++++++++ 3 files changed, 21 insertions(+), 1 deletion(-) diff --git a/components/ILIAS/UI/src/Component/Component.php b/components/ILIAS/UI/src/Component/Component.php index 3019102dd770..029968e0a492 100755 --- a/components/ILIAS/UI/src/Component/Component.php +++ b/components/ILIAS/UI/src/Component/Component.php @@ -34,7 +34,7 @@ public function getCanonicalName(): string; /** * The scheme starts at the leaves of the structure and applies the function * to each leave and moves up the tree recursively. - * @param Closure(Component, array): mixed $fn + * @param \Closure(Component, array): mixed $fn */ public function reduceWith(\Closure $fn): mixed; diff --git a/components/ILIAS/UI/src/Component/Input/Field/Numeric.php b/components/ILIAS/UI/src/Component/Input/Field/Numeric.php index a18ffe06a7db..3527e935d6d4 100755 --- a/components/ILIAS/UI/src/Component/Input/Field/Numeric.php +++ b/components/ILIAS/UI/src/Component/Input/Field/Numeric.php @@ -27,6 +27,15 @@ */ interface Numeric extends FilterInput { + /** + * Returns the step size used for this numeric input field. + * This value specifies the step size used when incrementing or decrementing the field's value + * via arrow controls, or during validation checks. + * + * @return int|float The configured step size of the input field. + */ + public function getStepSize(): int|float; + /** * This will not only set the steps for the input's arrow controls, * but will also alter the field's transformation. diff --git a/components/ILIAS/UI/src/Component/Input/Input.php b/components/ILIAS/UI/src/Component/Input/Input.php index c706da2970eb..570cc1b88e10 100755 --- a/components/ILIAS/UI/src/Component/Input/Input.php +++ b/components/ILIAS/UI/src/Component/Input/Input.php @@ -68,6 +68,17 @@ public function withValue($value); */ public function withAdditionalTransformation(Transformation $trafo); + /** + * Retrieves the dedicated name for this input component. + * This name, if set via {@see Input::withDedicatedName(string $dedicated_name)}, + * is used in the NAME attribute of the rendered input (instead of the auto-generated 'input_x'). + * If no dedicated name was set, it returns null. + * The dedicated name can be useful for customizing how inputs are submitted or referenced programmatically. + * + * @return string|null The optional dedicated name assigned to this input, or null if none is set. + */ + public function getDedicatedName(): ?string; + /** * Sets an optional dedicated name for this input which is used in the NAME * attribute of the rendered input (instead of the auto-generated 'input_x'). From 0d22f1045dc83acc719755ec8f5e39873efd2553 Mon Sep 17 00:00:00 2001 From: Ahmed Hamouda Date: Fri, 26 Jun 2026 13:18:25 +0200 Subject: [PATCH 2/2] add getDedicatedName method to mock builder in tests --- .../UI/tests/Component/Input/Container/Filter/FilterTest.php | 1 + .../ILIAS/UI/tests/Component/Input/Container/Form/FormTest.php | 1 + 2 files changed, 2 insertions(+) diff --git a/components/ILIAS/UI/tests/Component/Input/Container/Filter/FilterTest.php b/components/ILIAS/UI/tests/Component/Input/Container/Filter/FilterTest.php index 0e1a0b1ee7bf..0706bf75971e 100755 --- a/components/ILIAS/UI/tests/Component/Input/Container/Filter/FilterTest.php +++ b/components/ILIAS/UI/tests/Component/Input/Container/Filter/FilterTest.php @@ -452,6 +452,7 @@ protected function inputMock() ->getMockBuilder(Input\Field\FormInputInternal::class) ->onlyMethods([ "getName", + "getDedicatedName", "withDedicatedName", "withNameFrom", "withInput", diff --git a/components/ILIAS/UI/tests/Component/Input/Container/Form/FormTest.php b/components/ILIAS/UI/tests/Component/Input/Container/Form/FormTest.php index 4a41cbc748b1..fbc67ae95da3 100755 --- a/components/ILIAS/UI/tests/Component/Input/Container/Form/FormTest.php +++ b/components/ILIAS/UI/tests/Component/Input/Container/Form/FormTest.php @@ -437,6 +437,7 @@ protected function inputMock() ->getMockBuilder(Input\Field\FormInputInternal::class) ->onlyMethods([ "getName", + "getDedicatedName", "withDedicatedName", "withNameFrom", "withInput",