Skip to content

Commit bca9760

Browse files
committed
match expectations created in symfony#1590
1 parent 1767db3 commit bca9760

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

tests/fixtures/make-validator/expected/FooBar.php

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,18 @@
44

55
use Symfony\Component\Validator\Constraint;
66

7-
/**
8-
* @Annotation
9-
* @Target({"PROPERTY", "METHOD", "ANNOTATION"})
10-
*/
117
#[\Attribute(\Attribute::TARGET_PROPERTY | \Attribute::TARGET_METHOD | \Attribute::IS_REPEATABLE)]
128
final class FooBar extends Constraint
139
{
14-
/*
15-
* Any public properties become valid options for the annotation.
16-
* Then, use these in your validator class.
17-
*/
18-
public string $message = 'The value "{{ value }}" is not valid.';
10+
public string $message = 'The string "{{ string }}" contains an illegal character: it can only contain letters or numbers.';
11+
12+
// You can use #[HasNamedArguments] to make some constraint options required.
13+
// All configurable options must be passed to the constructor.
14+
public function __construct(
15+
public string $mode = 'strict',
16+
?array $groups = null,
17+
mixed $payload = null
18+
) {
19+
parent::__construct([], $groups, $payload);
20+
}
1921
}

0 commit comments

Comments
 (0)