Skip to content

Commit a151802

Browse files
minor symfony#59561 [Validator] Fix constraints deprecations (alexandre-daubois)
This PR was merged into the 7.3 branch. Discussion ---------- [Validator] Fix constraints deprecations | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | yes | New feature? | no | Deprecations? | no | Issues | - | License | MIT Small tweak after the recent merge when having a look at the commit 🙂 (see symfony#54744) cc `@xabbuh` Commits ------- 89b7a2e [Validator] Fix constraints deprecations
2 parents e348b70 + 89b7a2e commit a151802

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+107
-107
lines changed

src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntity.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,12 +63,12 @@ public function __construct(
6363
?array $options = null,
6464
) {
6565
if (\is_array($fields) && \is_string(key($fields)) && [] === array_diff(array_keys($fields), array_merge(array_keys(get_class_vars(static::class)), ['value']))) {
66-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
66+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
6767

6868
$options = array_merge($fields, $options ?? []);
6969
} else {
7070
if (\is_array($options)) {
71-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
71+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
7272
} else {
7373
$options = [];
7474
}

src/Symfony/Component/Validator/Constraints/AbstractComparison.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ abstract class AbstractComparison extends Constraint
3333
public function __construct(mixed $value = null, ?string $propertyPath = null, ?string $message = null, ?array $groups = null, mixed $payload = null, ?array $options = null)
3434
{
3535
if (\is_array($value)) {
36-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
36+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
3737

3838
$options = array_merge($value, $options ?? []);
3939
} elseif (null !== $value) {
4040
if (\is_array($options)) {
41-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
41+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
4242
} else {
4343
$options = [];
4444
}

src/Symfony/Component/Validator/Constraints/All.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class All extends Composite
3333
public function __construct(mixed $constraints = null, ?array $groups = null, mixed $payload = null)
3434
{
3535
if (\is_array($constraints) && !array_is_list($constraints)) {
36-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
36+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
3737
}
3838

3939
parent::__construct($constraints ?? [], $groups, $payload);

src/Symfony/Component/Validator/Constraints/AtLeastOneOf.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ class AtLeastOneOf extends Composite
4242
public function __construct(mixed $constraints = null, ?array $groups = null, mixed $payload = null, ?string $message = null, ?string $messageCollection = null, ?bool $includeInternalMessages = null)
4343
{
4444
if (\is_array($constraints) && !array_is_list($constraints)) {
45-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
45+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
4646
}
4747

4848
parent::__construct($constraints ?? [], $groups, $payload);

src/Symfony/Component/Validator/Constraints/Bic.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ public function __construct(
9292
throw new InvalidArgumentException('The "mode" parameter value is not valid.');
9393
}
9494

95-
if ($options) {
96-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
95+
if (\is_array($options)) {
96+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
9797
}
9898

9999
parent::__construct($options, $groups, $payload);

src/Symfony/Component/Validator/Constraints/Blank.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,8 @@ class Blank extends Constraint
3737
#[HasNamedArguments]
3838
public function __construct(?array $options = null, ?string $message = null, ?array $groups = null, mixed $payload = null)
3939
{
40-
if ($options) {
41-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
40+
if (\is_array($options)) {
41+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
4242
}
4343

4444
parent::__construct($options ?? [], $groups, $payload);

src/Symfony/Component/Validator/Constraints/Callback.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,21 +36,21 @@ public function __construct(array|string|callable|null $callback = null, ?array
3636
{
3737
// Invocation through attributes with an array parameter only
3838
if (\is_array($callback) && 1 === \count($callback) && isset($callback['value'])) {
39-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
39+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
4040

4141
$callback = $callback['value'];
4242
}
4343

4444
if (!\is_array($callback) || (!isset($callback['callback']) && !isset($callback['groups']) && !isset($callback['payload']))) {
4545
if (\is_array($options)) {
46-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
46+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
4747
} else {
4848
$options = [];
4949
}
5050

5151
$options['callback'] = $callback;
5252
} else {
53-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
53+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
5454

5555
$options = array_merge($callback, $options ?? []);
5656
}

src/Symfony/Component/Validator/Constraints/CardScheme.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,12 +56,12 @@ class CardScheme extends Constraint
5656
public function __construct(array|string|null $schemes, ?string $message = null, ?array $groups = null, mixed $payload = null, ?array $options = null)
5757
{
5858
if (\is_array($schemes) && \is_string(key($schemes))) {
59-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
59+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
6060

6161
$options = array_merge($schemes, $options ?? []);
6262
} else {
6363
if (\is_array($options)) {
64-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
64+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
6565
} else {
6666
$options = [];
6767
}

src/Symfony/Component/Validator/Constraints/Cascade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,12 @@ class Cascade extends Constraint
3333
public function __construct(array|string|null $exclude = null, ?array $options = null)
3434
{
3535
if (\is_array($exclude) && !array_is_list($exclude)) {
36-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
36+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
3737

3838
$options = array_merge($exclude, $options ?? []);
3939
} else {
4040
if (\is_array($options)) {
41-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
41+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
4242
}
4343

4444
$this->exclude = array_flip((array) $exclude);

src/Symfony/Component/Validator/Constraints/Choice.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public function __construct(
8181
$choices ??= $options;
8282
$options = [];
8383
} elseif (\is_array($options) && [] !== $options) {
84-
trigger_deprecation('symfony/validator', '7.2', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
84+
trigger_deprecation('symfony/validator', '7.3', 'Passing an array of options to configure the "%s" constraint is deprecated, use named arguments instead.', static::class);
8585
}
8686

8787
if (null !== $choices) {

0 commit comments

Comments
 (0)