Skip to content

Commit 45c99af

Browse files
Merge branch '5.4' into 6.0
* 5.4: (22 commits) fix cs Update validators.lv.xlf Fix API gateway service name Improve recommendation message for "composer req" Fix CS in composer.json [DependencyInjection] fix preloading Update validators.uz.xlf AddMake ExpressionVoter Cacheable Add framework config for DBAL cache adapter [ExpressionLanguage] Fix LexerTest number types [Process] intersect with getenv() to populate default envs Improve CI script a bit Fix deprecation message placeholders [Cache] Fix calculate ttl in couchbase sdk 3.0 Fix Loco Provider [Cache] fix dbindex Redis Fix typos in a test message [Cache] fix releasing not acquired locks [DependencyInjection] fix creating 2nd container instances Never rely on dynamic properties ...
2 parents a21f01b + 601eeb5 commit 45c99af

File tree

7 files changed

+26
-14
lines changed

7 files changed

+26
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ CHANGELOG
180180
3.2.0
181181
-----
182182

183-
* deprecated `Tests\Constraints\AbstractContraintValidatorTest` in favor of `Test\ConstraintValidatorTestCase`
183+
* deprecated `Tests\Constraints\AbstractConstraintValidatorTest` in favor of `Test\ConstraintValidatorTestCase`
184184
* added support for PHP constants in YAML configuration files
185185

186186
3.1.0

Constraint.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
*
2626
* Constraint instances are immutable and serializable.
2727
*
28-
* @property string[] $groups The groups that the constraint belongs to
29-
*
3028
* @author Bernhard Schussek <[email protected]>
3129
*/
3230
abstract class Constraint
@@ -58,6 +56,13 @@ abstract class Constraint
5856
*/
5957
public $payload;
6058

59+
/**
60+
* The groups that the constraint belongs to.
61+
*
62+
* @var string[]
63+
*/
64+
public $groups;
65+
6166
/**
6267
* Returns the name of the given error code.
6368
*
@@ -103,6 +108,8 @@ public static function getErrorName(string $errorCode): string
103108
*/
104109
public function __construct(mixed $options = null, array $groups = null, mixed $payload = null)
105110
{
111+
unset($this->groups); // enable lazy initialization
112+
106113
$options = $this->normalizeOptions($options);
107114
if (null !== $groups) {
108115
$options['groups'] = $groups;
@@ -122,9 +129,6 @@ protected function normalizeOptions(mixed $options): array
122129
$missingOptions = array_flip((array) $this->getRequiredOptions());
123130
$knownOptions = get_class_vars(static::class);
124131

125-
// The "groups" option is added to the object lazily
126-
$knownOptions['groups'] = true;
127-
128132
if (\is_array($options) && isset($options['value']) && !property_exists($this, 'value')) {
129133
if (null === $defaultOption) {
130134
throw new ConstraintDefinitionException(sprintf('No default option is configured for constraint "%s".', static::class));

Constraints/Composite.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ public function __construct(mixed $options = null, array $groups = null, mixed $
7979
}
8080
}
8181

82-
if (!property_exists($this, 'groups')) {
82+
if (!isset(((array) $this)['groups'])) {
8383
$mergedGroups = [];
8484

8585
foreach ($nestedConstraints as $constraint) {
@@ -96,7 +96,7 @@ public function __construct(mixed $options = null, array $groups = null, mixed $
9696
}
9797

9898
foreach ($nestedConstraints as $constraint) {
99-
if (property_exists($constraint, 'groups')) {
99+
if (isset(((array) $constraint)['groups'])) {
100100
$excessGroups = array_diff($constraint->groups, $this->groups);
101101

102102
if (\count($excessGroups) > 0) {
@@ -137,7 +137,7 @@ abstract protected function getCompositeOption(): string;
137137
*
138138
* @return Constraint[]
139139
*/
140-
public function getNestedContraints(): array
140+
public function getNestedConstraints(): array
141141
{
142142
/* @var Constraint[] $nestedConstraints */
143143
return $this->{$this->getCompositeOption()};

Mapping/ClassMetadata.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,8 @@ private function checkConstraint(Constraint $constraint)
490490
}
491491

492492
if ($constraint instanceof Composite) {
493-
foreach ($constraint->getNestedContraints() as $nestedContraint) {
494-
$this->checkConstraint($nestedContraint);
493+
foreach ($constraint->getNestedConstraints() as $nestedConstraint) {
494+
$this->checkConstraint($nestedConstraint);
495495
}
496496
}
497497
}

Mapping/MemberMetadata.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ private function checkConstraint(Constraint $constraint)
166166
}
167167

168168
if ($constraint instanceof Composite) {
169-
foreach ($constraint->getNestedContraints() as $nestedContraint) {
170-
$this->checkConstraint($nestedContraint);
169+
foreach ($constraint->getNestedConstraints() as $nestedConstraint) {
170+
$this->checkConstraint($nestedConstraint);
171171
}
172172
}
173173
}

Resources/translations/validators.lv.xlf

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@
268268
</trans-unit>
269269
<trans-unit id="70">
270270
<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>
272272
</trans-unit>
273273
<trans-unit id="71">
274274
<source>This value should not be equal to {{ compared_value }}.</source>

Resources/translations/validators.uz.xlf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,14 @@
394394
<source>This value is not a valid CSS color.</source>
395395
<target>Bu qiymat haqiqiy CSS rangi emas.</target>
396396
</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>
397405
</body>
398406
</file>
399407
</xliff>

0 commit comments

Comments
 (0)