Skip to content

[Config] Documentation of the new numerical type handling #1732

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 31, 2012
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion components/config/definition.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,10 +100,39 @@ node definition. Node type are available for:
* scalar
* boolean
* array
* enum (new in 2.1)
* integer (new in 2.2)
* float (new in 2.2)
* variable (no validation)

and are created with ``node($name, $type)`` or their associated shortcut
``xxxxNode($name)`` method.
``xxxxNode($name)`` method.

Numeric node constraints
~~~~~~~~~~~~~~~~~~~~~~~~

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This need a .. versionadded:: 2.2 note

.. versionadded:: 2.2

The numeric (float and integer) nodes are new in 2.2

Numeric node (float and integer) provide two extra constraints min() and
max() allowing to validate the value:

.. code-block:: php
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should to remove this line (ad the one before this) and replace the : with :: (at the end of the sentence)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wouterj What is the logic about using code-block or using the :: notation?


$rootNode
->children()
->integerNode('positive_value')
->min(0)
->end()
->floatNode('big_value')
->max(5E45)
->end()
->integerNode('value_inside_a_range')
->min(-50)->max(50)
->end()
->end()
;

Array nodes
~~~~~~~~~~~
Expand Down