Skip to content

Commit

Permalink
bug #54716 [Validator] add missing HasNamedArguments attribute (xabbuh)
Browse files Browse the repository at this point in the history
This PR was merged into the 7.1 branch.

Discussion
----------

[Validator] add missing HasNamedArguments attribute

| Q             | A
| ------------- | ---
| Branch?       | 7.1
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Issues        |
| License       | MIT

Commits
-------

56e7867 add missing HasNamedArguments attribute
  • Loading branch information
nicolas-grekas committed Apr 25, 2024
2 parents 3903840 + 56e7867 commit 0d7c20a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/Symfony/Component/Validator/Constraints/Charset.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Validator\Constraints;

use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;

Expand All @@ -26,6 +27,7 @@ final class Charset extends Constraint
self::BAD_ENCODING_ERROR => 'BAD_ENCODING_ERROR',
];

#[HasNamedArguments]
public function __construct(
public array|string $encodings = [],
public string $message = 'The detected character encoding is invalid ({{ detected }}). Allowed encodings are {{ encodings }}.',
Expand Down
2 changes: 2 additions & 0 deletions src/Symfony/Component/Validator/Constraints/MacAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

namespace Symfony\Component\Validator\Constraints;

use Symfony\Component\Validator\Attribute\HasNamedArguments;
use Symfony\Component\Validator\Constraint;
use Symfony\Component\Validator\Exception\ConstraintDefinitionException;

Expand Down Expand Up @@ -65,6 +66,7 @@ class MacAddress extends Constraint
/**
* @param self::ALL*|self::LOCAL_*|self::UNIVERSAL_*|self::UNICAST_*|self::MULTICAST_*|self::BROADCAST $type A mac address type to validate (defaults to {@see self::ALL})
*/
#[HasNamedArguments]
public function __construct(
public string $message = 'This value is not a valid MAC address.',
public string $type = self::ALL,
Expand Down

0 comments on commit 0d7c20a

Please sign in to comment.