Skip to content

Commit d22ad24

Browse files
committed
[Validator] Add additional versions (*_NO_PUBLIC, *_ONLY_PRIV & *_ONLY_RES) in IP address & CIDR constraint
1 parent ff73500 commit d22ad24

File tree

2 files changed

+38
-4
lines changed

2 files changed

+38
-4
lines changed

reference/constraints/Cidr.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,10 +124,10 @@ Parameter Description
124124
**type**: ``string`` **default**: ``all``
125125

126126
This determines exactly *how* the CIDR notation is validated and can take one
127-
of these values:
127+
of :ref:`IP version ranges <reference-constraint-ip-version>`.
128128

129-
* ``4``: validates for CIDR notations that have an IPv4;
130-
* ``6``: validates for CIDR notations that have an IPv6;
131-
* ``all``: validates all CIDR formats.
129+
.. versionadded:: 7.1
130+
131+
The support of all IP version ranges was introduced in Symfony 7.1.
132132

133133
.. _`CIDR`: https://en.wikipedia.org/wiki/Classless_Inter-Domain_Routing

reference/constraints/Ip.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,8 @@ Parameter Description
9797

9898
.. include:: /reference/constraints/_payload-option.rst.inc
9999

100+
.. _reference-constraint-ip-version:
101+
100102
``version``
101103
~~~~~~~~~~~
102104

@@ -132,6 +134,33 @@ of a variety of different values:
132134
``all_no_res``
133135
Validates for all IP formats but without reserved IP ranges
134136

137+
**No public ranges**
138+
139+
``4_no_public``
140+
Validates for IPv4 but without public IP ranges
141+
``6_no_public``
142+
Validates for IPv6 but without public IP ranges
143+
``all_no_public``
144+
Validates for all IP formats but without public IP range
145+
146+
**Only private ranges**
147+
148+
``4_private``
149+
Validates for IPv4 but without public and reserved ranges
150+
``6_private``
151+
Validates for IPv6 but without public and reserved ranges
152+
``all_private``
153+
Validates for all IP formats but without public and reserved ranges
154+
155+
**Only reserved ranges**
156+
157+
``4_reserved``
158+
Validates for IPv4 but without private and public ranges
159+
``6_reserved``
160+
Validates for IPv6 but without private and public ranges
161+
``all_reserved``
162+
Validates for all IP formats but without private and public ranges
163+
135164
**Only public ranges**
136165

137166
``4_public``
@@ -140,3 +169,8 @@ of a variety of different values:
140169
Validates for IPv6 but without private and reserved ranges
141170
``all_public``
142171
Validates for all IP formats but without private and reserved ranges
172+
173+
.. versionadded:: 7.1
174+
175+
The ``*_no_public``, ``*_reserved`` and ``*_public`` ranges were introduced
176+
in Symfony 7.1.

0 commit comments

Comments
 (0)