Skip to content

Commit 730a31b

Browse files
committed
Merge pull request #1732 from jeanmonod/documentation-for-PR4714
[Config] Documentation of the new numerical type handling
2 parents dd2049a + e95632c commit 730a31b

File tree

1 file changed

+30
-1
lines changed

1 file changed

+30
-1
lines changed

components/config/definition.rst

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,39 @@ node definition. Node type are available for:
100100
* scalar
101101
* boolean
102102
* array
103+
* enum (new in 2.1)
104+
* integer (new in 2.2)
105+
* float (new in 2.2)
103106
* variable (no validation)
104107

105108
and are created with ``node($name, $type)`` or their associated shortcut
106-
``xxxxNode($name)`` method.
109+
``xxxxNode($name)`` method.
110+
111+
Numeric node constraints
112+
~~~~~~~~~~~~~~~~~~~~~~~~
113+
114+
.. versionadded:: 2.2
115+
116+
The numeric (float and integer) nodes are new in 2.2
117+
118+
Numeric node (float and integer) provide two extra constraints min() and
119+
max() allowing to validate the value:
120+
121+
.. code-block:: php
122+
123+
$rootNode
124+
->children()
125+
->integerNode('positive_value')
126+
->min(0)
127+
->end()
128+
->floatNode('big_value')
129+
->max(5E45)
130+
->end()
131+
->integerNode('value_inside_a_range')
132+
->min(-50)->max(50)
133+
->end()
134+
->end()
135+
;
107136
108137
Array nodes
109138
~~~~~~~~~~~

0 commit comments

Comments
 (0)