Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1c82511

Browse filesBrowse files
committed
minor symfony#21622 [Validator] Fix parent constructor call to use null instead of empty array (ReeceG)
This PR was merged into the 6.4 branch. Discussion ---------- [Validator] Fix parent constructor call to use null instead of empty array This is the new method that prevents the following deprecation message: `Since symfony/validator 7.4: Support for evaluating options in the base Constraint class is deprecated. Initialize properties in the constructor of App\Validator\Custom instead` Honestly I don't totally understand what the "mode" option/variable in the 2nd and 3rd examples is doing so I'm not sure if some other change needs to be made for those ones. Commits ------- a9a1410 Fix parent constructor call to use null instead of empty array
2 parents 5ed02f3 + a9a1410 commit 1c82511
Copy full SHA for 1c82511

File tree

Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+4
-4
lines changed
Open diff view settings
Collapse file

‎validation/custom_constraint.rst‎

Copy file name to clipboardExpand all lines: validation/custom_constraint.rst
+4-4Lines changed: 4 additions & 4 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,10 @@ First you need to create a Constraint class and extend :class:`Symfony\\Componen
2929
// all configurable options must be passed to the constructor
3030
public function __construct(?string $mode = null, ?string $message = null, ?array $groups = null, $payload = null)
3131
{
32-
parent::__construct([], $groups, $payload);
33-
3432
$this->mode = $mode ?? $this->mode;
3533
$this->message = $message ?? $this->message;
34+
35+
parent::__construct(null, $groups, $payload);
3636
}
3737
}
3838
@@ -62,7 +62,7 @@ You can use ``#[HasNamedArguments]`` to make some constraint options required::
6262
?array $groups = null,
6363
mixed $payload = null,
6464
) {
65-
parent::__construct([], $groups, $payload);
65+
parent::__construct(null, $groups, $payload);
6666
}
6767
}
6868

@@ -93,7 +93,7 @@ in the ``__sleep()`` method to ensure they are serialized correctly::
9393
?array $groups = null,
9494
mixed $payload = null,
9595
) {
96-
parent::__construct([], $groups, $payload);
96+
parent::__construct(null, $groups, $payload);
9797
}
9898

9999
public function __sleep(): array

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.