File tree Expand file tree Collapse file tree 2 files changed +10
-10
lines changed
Expand file tree Collapse file tree 2 files changed +10
-10
lines changed Original file line number Diff line number Diff line change @@ -196,13 +196,13 @@ you can do the following:
196196 {
197197 #[Assert\Collection(
198198 fields: [
199- 'personal_email' => new Assert\Required([
199+ 'personal_email' => new Assert\Required(constraints: [
200200 new Assert\NotBlank,
201201 new Assert\Email,
202202 ]),
203- 'alternate_email' => new Assert\Optional(
203+ 'alternate_email' => new Assert\Optional(constraints: [
204204 new Assert\Email
205- ),
205+ ] ),
206206 ],
207207 )]
208208 protected array $profileData = ['personal_email' => '[email protected] ']; @@ -269,11 +269,11 @@ you can do the following:
269269 {
270270 $metadata->addPropertyConstraint('profileData', new Assert\Collection(
271271 fields: [
272- 'personal_email' => new Assert\Required([
272+ 'personal_email' => new Assert\Required(required: [
273273 new Assert\NotBlank(),
274274 new Assert\Email(),
275275 ]),
276- 'alternate_email' => new Assert\Optional(new Assert\Email()),
276+ 'alternate_email' => new Assert\Optional(constraints: [ new Assert\Email()] ),
277277 ],
278278 ));
279279 }
Original file line number Diff line number Diff line change @@ -78,11 +78,11 @@ Validation of arrays is possible using the ``Collection`` constraint::
7878 'eye_color' => new Assert\Choice(choices: [3, 4]),
7979 'file' => new Assert\File(),
8080 'password' => new Assert\Length(['min' => 60]),
81- 'tags' => new Assert\Optional([
82- new Assert\Type('array'),
83- new Assert\Count([' min' => 1] ),
81+ 'tags' => new Assert\Optional(constraints: [
82+ new Assert\Type(type: 'array'),
83+ new Assert\Count(min: 1 ),
8484 new Assert\All([
85- new Assert\Collection([
85+ new Assert\Collection(constraints: [
8686 'slug' => [
8787 new Assert\NotBlank(),
8888 new Assert\Type(['type' => 'string']),
@@ -91,7 +91,7 @@ Validation of arrays is possible using the ``Collection`` constraint::
9191 new Assert\NotBlank(),
9292 ],
9393 ]),
94- new CustomUniqueTagValidator([' groups' => 'custom']),
94+ new CustomUniqueTagValidator(groups: [ 'custom']),
9595 ]),
9696 ]),
9797 ]);
You can’t perform that action at this time.
0 commit comments