Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit676dff1

Browse files
committed
Documentation of the new numerical type handling
1 parent46fe35f commit676dff1

File tree

1 file changed

+29
-1
lines changed

1 file changed

+29
-1
lines changed

‎components/config/definition.rst‎

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ Variable nodes
7474

7575
A tree contains node definitions which can be laid out in a semantic way.
7676
This means, using indentation and the fluent notation, it is possible to
77-
reflect the real structure of the configuration values::
77+
reflect the real structure of the configuration values:
7878

7979
$rootNode
8080
->children()
@@ -100,11 +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
106109
``xxxxNode($name)`` method.
107110

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 max() allowing to validate the value:
119+
120+
..code-block::php
121+
122+
$rootNode
123+
->children()
124+
->integerNode('positive_value')
125+
->min(0)
126+
->end()
127+
->floatNode('big_value')
128+
->max(5E45)
129+
->end()
130+
->integerNode('value_inside_a_range')
131+
->min(-50)->max(50)
132+
->end()
133+
->end()
134+
;
135+
108136
Array nodes
109137
~~~~~~~~~~~
110138

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp