Skip to content

Commit 60da7c2

Browse files
committed
Merge branch '5.4' into 6.0
* 5.4: [Validator] Cidr constraint tweaks
2 parents c459a8a + 3a24202 commit 60da7c2

File tree

1 file changed

+20
-25
lines changed

1 file changed

+20
-25
lines changed

reference/constraints/Cidr.rst

Lines changed: 20 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ Basic Usage
1919

2020
.. code-block:: php-annotations
2121
22-
// src/Entity/Author.php
22+
// src/Entity/NetworkSettings.php
2323
namespace App\Entity;
2424
2525
use Symfony\Component\Validator\Constraints as Assert;
2626
27-
class Author
27+
class NetworkSettings
2828
{
2929
/**
3030
* @Assert\Cidr
@@ -34,12 +34,12 @@ Basic Usage
3434
3535
.. code-block:: php-attributes
3636
37-
// src/Entity/Author.php
37+
// src/Entity/NetworkSettings.php
3838
namespace App\Entity;
3939
4040
use Symfony\Component\Validator\Constraints as Assert;
4141
42-
class Author
42+
class NetworkSettings
4343
{
4444
#[Assert\Cidr]
4545
protected $cidrNotation;
@@ -48,7 +48,7 @@ Basic Usage
4848
.. code-block:: yaml
4949
5050
# config/validator/validation.yaml
51-
App\Entity\Author:
51+
App\Entity\NetworkSettings:
5252
properties:
5353
cidrNotation:
5454
- Cidr: ~
@@ -61,7 +61,7 @@ Basic Usage
6161
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
6262
xsi:schemaLocation="http://symfony.com/schema/dic/constraint-mapping https://symfony.com/schema/dic/constraint-mapping/constraint-mapping-1.0.xsd">
6363
64-
<class name="App\Entity\Author">
64+
<class name="App\Entity\NetworkSettings">
6565
<property name="cidrNotation">
6666
<constraint name="Cidr"/>
6767
</property>
@@ -70,13 +70,13 @@ Basic Usage
7070
7171
.. code-block:: php
7272
73-
// src/Entity/Author.php
73+
// src/Entity/NetworkSettings.php
7474
namespace App\Entity;
7575
7676
use Symfony\Component\Validator\Constraints as Assert;
7777
use Symfony\Component\Validator\Mapping\ClassMetadata;
7878
79-
class Author
79+
class NetworkSettings
8080
{
8181
public static function loadValidatorMetadata(ClassMetadata $metadata)
8282
{
@@ -99,34 +99,34 @@ Options
9999
This message is shown if the string is not a valid CIDR notation.
100100

101101
``netmaskMin``
102-
~~~~~~~~~~~
102+
~~~~~~~~~~~~~~
103103

104104
**type**: ``integer`` **default**: ``0``
105105

106106
It's a constraint for the lowest value a valid netmask may have.
107107

108108
``netmaskMax``
109-
~~~~~~~~~~~
109+
~~~~~~~~~~~~~~
110110

111-
**type**: ``string`` **default**: ``32 for IPv4 or 128 for IPv6``
111+
**type**: ``string`` **default**: ``32`` for IPv4 or ``128`` for IPv6
112112

113113
It's a constraint for the biggest value a valid netmask may have.
114114

115115
``netmaskRangeViolationMessage``
116-
~~~~~~~~~~~
116+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
117117

118118
**type**: ``string`` **default**: ``The value of the netmask should be between {{ min }} and {{ max }}.``
119119

120-
This message is shown if the value of the CIDR's netmask is bigger then the value of the `max_` or lower than
121-
the value of the `min_`.
120+
This message is shown if the value of the CIDR's netmask is bigger than the
121+
``netmaskMax`` value or lower than the ``netmaskMin`` value.
122122

123123
You can use the following parameters in this message:
124124

125125
=============== ==============================================================
126126
Parameter Description
127127
=============== ==============================================================
128-
``{{ min }}`` The minimum value a CIDR netmask may have
129-
``{{ max }}`` The maximum value a CIDR netmask may have
128+
``{{ min }}`` The minimum value a CIDR netmask may have
129+
``{{ max }}`` The maximum value a CIDR netmask may have
130130
=============== ==============================================================
131131

132132
.. include:: /reference/constraints/_payload-option.rst.inc
@@ -137,15 +137,10 @@ Parameter Description
137137
**type**: ``string`` **default**: ``all``
138138

139139
This determines exactly *how* the CIDR notation is validated and can take one
140-
of a variety of different values:
141-
142-
**All ranges**
140+
of these values:
143141

144-
``4``
145-
Validates for CIDR notations that have an IPv4.
146-
``6``
147-
Validates for CIDR notations that have an IPv6.
148-
``all``
149-
Validates all CIDR formats
142+
* ``4``: validates for CIDR notations that have an IPv4;
143+
* ``6``: validates for CIDR notations that have an IPv6;
144+
* ``all``: validates all CIDR formats.
150145

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

0 commit comments

Comments
 (0)