File tree Expand file tree Collapse file tree 1 file changed +11
-9
lines changed
tests/fixtures/make-validator/expected Expand file tree Collapse file tree 1 file changed +11
-9
lines changed Original file line number Diff line number Diff line change 44
55use 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 )]
128final 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}
You can’t perform that action at this time.
0 commit comments