Skip to content

Commit 1714f71

Browse files
bug #60840 [Validator] Add missing HasNamedArguments to some constraints (jkgroupe)
This PR was merged into the 7.3 branch. Discussion ---------- [Validator] Add missing HasNamedArguments to some constraints | Q | A | ------------- | --- | Branch? | 7.3 | Bug fix? | no | New feature? | no | Deprecations? | yes | Issues | Fix #60838 | License | MIT Add missing `HasNamedArguments` attribute on `__construct(...)` to fix symfony 7.4 deprecation Commits ------- cce8eac [Validator] Add missing HasNamedArguments to some constraints
2 parents 4b31dc6 + cce8eac commit 1714f71

File tree

7 files changed

+16
-0
lines changed

7 files changed

+16
-0
lines changed

src/Symfony/Component/Security/Core/Validator/Constraints/UserPassword.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Security\Core\Validator\Constraints;
1313

14+
use Symfony\Component\Validator\Attribute\HasNamedArguments;
1415
use Symfony\Component\Validator\Constraint;
1516

1617
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
@@ -25,6 +26,7 @@ class UserPassword extends Constraint
2526
public string $message = 'This value should be the user\'s current password.';
2627
public string $service = 'security.validator.user_password';
2728

29+
#[HasNamedArguments]
2830
public function __construct(?array $options = null, ?string $message = null, ?string $service = null, ?array $groups = null, mixed $payload = null)
2931
{
3032
parent::__construct($options, $groups, $payload);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Validator\Constraints;
1313

14+
use Symfony\Component\Validator\Attribute\HasNamedArguments;
1415
use Symfony\Component\Validator\Constraint;
1516

1617
/**
@@ -39,6 +40,7 @@ class AtLeastOneOf extends Composite
3940
* @param string|null $messageCollection Failure message for All and Collection inner constraints
4041
* @param bool|null $includeInternalMessages Whether to include inner constraint messages (defaults to true)
4142
*/
43+
#[HasNamedArguments]
4244
public function __construct(mixed $constraints = null, ?array $groups = null, mixed $payload = null, ?string $message = null, ?string $messageCollection = null, ?bool $includeInternalMessages = null)
4345
{
4446
if (\is_array($constraints) && !array_is_list($constraints)) {

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Validator\Constraints;
1313

14+
use Symfony\Component\Validator\Attribute\HasNamedArguments;
1415
use Symfony\Component\Validator\Constraint;
1516
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
1617

@@ -49,6 +50,7 @@ abstract class Composite extends Constraint
4950
* cached. When constraints are loaded from the cache, no more group
5051
* checks need to be done.
5152
*/
53+
#[HasNamedArguments]
5254
public function __construct(mixed $options = null, ?array $groups = null, mixed $payload = null)
5355
{
5456
parent::__construct($options, $groups, $payload);

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Validator\Constraints;
1313

14+
use Symfony\Component\Validator\Attribute\HasNamedArguments;
1415
use Symfony\Component\Validator\Constraint;
1516
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;
1617

@@ -24,6 +25,7 @@ abstract class Compound extends Composite
2425
/** @var Constraint[] */
2526
public array $constraints = [];
2627

28+
#[HasNamedArguments]
2729
public function __construct(mixed $options = null, ?array $groups = null, mixed $payload = null)
2830
{
2931
if (isset($options[$this->getCompositeOption()])) {

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Validator\Constraints;
1313

14+
use Symfony\Component\Validator\Attribute\HasNamedArguments;
15+
1416
/**
1517
* A sequence of validation groups.
1618
*
@@ -75,6 +77,7 @@ class GroupSequence
7577
*
7678
* @param array<string|string[]|GroupSequence> $groups The groups in the sequence
7779
*/
80+
#[HasNamedArguments]
7881
public function __construct(array $groups)
7982
{
8083
$this->groups = $groups['value'] ?? $groups;

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
namespace Symfony\Component\Validator\Constraints;
1313

14+
use Symfony\Component\Validator\Attribute\HasNamedArguments;
15+
1416
/**
1517
* Validates that a file (or a path to a file) is a valid image.
1618
*
@@ -118,6 +120,7 @@ class Image extends File
118120
*
119121
* @see https://www.iana.org/assignments/media-types/media-types.xhtml Existing media types
120122
*/
123+
#[HasNamedArguments]
121124
public function __construct(
122125
?array $options = null,
123126
int|string|null $maxSize = null,

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\Validator\Constraints;
1313

14+
use Symfony\Component\Validator\Attribute\HasNamedArguments;
1415
use Symfony\Component\Validator\Constraint;
1516

1617
/**
@@ -28,6 +29,7 @@ class Sequentially extends Composite
2829
* @param Constraint[]|array<string,mixed>|null $constraints An array of validation constraints
2930
* @param string[]|null $groups
3031
*/
32+
#[HasNamedArguments]
3133
public function __construct(mixed $constraints = null, ?array $groups = null, mixed $payload = null)
3234
{
3335
if (\is_array($constraints) && !array_is_list($constraints)) {

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy