File tree Expand file tree Collapse file tree 7 files changed +26
-14
lines changed Expand file tree Collapse file tree 7 files changed +26
-14
lines changed Original file line number Diff line number Diff line change @@ -163,7 +163,7 @@ CHANGELOG
163
163
3.2.0
164
164
-----
165
165
166
- * deprecated ` Tests\Constraints\AbstractContraintValidatorTest ` in favor of ` Test\ConstraintValidatorTestCase `
166
+ * deprecated ` Tests\Constraints\AbstractConstraintValidatorTest ` in favor of ` Test\ConstraintValidatorTestCase `
167
167
* added support for PHP constants in YAML configuration files
168
168
169
169
3.1.0
Original file line number Diff line number Diff line change 25
25
*
26
26
* Constraint instances are immutable and serializable.
27
27
*
28
- * @property string[] $groups The groups that the constraint belongs to
29
- *
30
28
* @author Bernhard Schussek <[email protected] >
31
29
*/
32
30
abstract class Constraint
@@ -58,6 +56,13 @@ abstract class Constraint
58
56
*/
59
57
public $ payload ;
60
58
59
+ /**
60
+ * The groups that the constraint belongs to.
61
+ *
62
+ * @var string[]
63
+ */
64
+ public $ groups ;
65
+
61
66
/**
62
67
* Returns the name of the given error code.
63
68
*
@@ -105,6 +110,8 @@ public static function getErrorName(string $errorCode)
105
110
*/
106
111
public function __construct ($ options = null , array $ groups = null , $ payload = null )
107
112
{
113
+ unset($ this ->groups ); // enable lazy initialization
114
+
108
115
$ options = $ this ->normalizeOptions ($ options );
109
116
if (null !== $ groups ) {
110
117
$ options ['groups ' ] = $ groups ;
@@ -124,9 +131,6 @@ protected function normalizeOptions($options): array
124
131
$ missingOptions = array_flip ((array ) $ this ->getRequiredOptions ());
125
132
$ knownOptions = get_class_vars (static ::class);
126
133
127
- // The "groups" option is added to the object lazily
128
- $ knownOptions ['groups ' ] = true ;
129
-
130
134
if (\is_array ($ options ) && isset ($ options ['value ' ]) && !property_exists ($ this , 'value ' )) {
131
135
if (null === $ defaultOption ) {
132
136
throw new ConstraintDefinitionException (sprintf ('No default option is configured for constraint "%s". ' , static ::class));
Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ public function __construct($options = null)
79
79
}
80
80
}
81
81
82
- if (!property_exists ( $ this , 'groups ' )) {
82
+ if (!isset ((( array ) $ this )[ 'groups ' ] )) {
83
83
$ mergedGroups = [];
84
84
85
85
foreach ($ nestedConstraints as $ constraint ) {
@@ -96,7 +96,7 @@ public function __construct($options = null)
96
96
}
97
97
98
98
foreach ($ nestedConstraints as $ constraint ) {
99
- if (property_exists ( $ constraint, 'groups ' )) {
99
+ if (isset ((( array ) $ constraint)[ 'groups ' ] )) {
100
100
$ excessGroups = array_diff ($ constraint ->groups , $ this ->groups );
101
101
102
102
if (\count ($ excessGroups ) > 0 ) {
@@ -139,7 +139,7 @@ abstract protected function getCompositeOption();
139
139
*
140
140
* @return Constraint[]
141
141
*/
142
- public function getNestedContraints ()
142
+ public function getNestedConstraints ()
143
143
{
144
144
/* @var Constraint[] $nestedConstraints */
145
145
return $ this ->{$ this ->getCompositeOption ()};
Original file line number Diff line number Diff line change @@ -505,8 +505,8 @@ private function checkConstraint(Constraint $constraint)
505
505
}
506
506
507
507
if ($ constraint instanceof Composite) {
508
- foreach ($ constraint ->getNestedContraints () as $ nestedContraint ) {
509
- $ this ->checkConstraint ($ nestedContraint );
508
+ foreach ($ constraint ->getNestedConstraints () as $ nestedConstraint ) {
509
+ $ this ->checkConstraint ($ nestedConstraint );
510
510
}
511
511
}
512
512
}
Original file line number Diff line number Diff line change @@ -188,8 +188,8 @@ private function checkConstraint(Constraint $constraint)
188
188
}
189
189
190
190
if ($ constraint instanceof Composite) {
191
- foreach ($ constraint ->getNestedContraints () as $ nestedContraint ) {
192
- $ this ->checkConstraint ($ nestedContraint );
191
+ foreach ($ constraint ->getNestedConstraints () as $ nestedConstraint ) {
192
+ $ this ->checkConstraint ($ nestedConstraint );
193
193
}
194
194
}
195
195
}
Original file line number Diff line number Diff line change 268
268
</trans-unit >
269
269
<trans-unit id =" 70" >
270
270
<source >This value should be less than or equal to {{ compared_value }}.</source >
271
- <target >TŠai vērtībai ir jābūt mazākai vai vienādai ar {{ compared_value }}.</target >
271
+ <target >Šai vērtībai ir jābūt mazākai vai vienādai ar {{ compared_value }}.</target >
272
272
</trans-unit >
273
273
<trans-unit id =" 71" >
274
274
<source >This value should not be equal to {{ compared_value }}.</source >
Original file line number Diff line number Diff line change 394
394
<source >This value is not a valid CSS color.</source >
395
395
<target >Bu qiymat haqiqiy CSS rangi emas.</target >
396
396
</trans-unit >
397
+ <trans-unit id =" 102" >
398
+ <source >This value is not a valid CIDR notation.</source >
399
+ <target >Qiymat CIDR belgisiga mos kelmaydi.</target >
400
+ </trans-unit >
401
+ <trans-unit id =" 103" >
402
+ <source >The value of the netmask should be between {{ min }} and {{ max }}.</source >
403
+ <target >Tarmoq niqobining qiymati {{ min }} va {{ max }} oralig'ida bo'lishi kerak.</target >
404
+ </trans-unit >
397
405
</body >
398
406
</file >
399
407
</xliff >
You can’t perform that action at this time.
0 commit comments