Skip to content

Commit 5856294

Browse files
[Validator] Use CPP in ConstraintViolation
1 parent 0b018cc commit 5856294

File tree

2 files changed

+14
-25
lines changed

2 files changed

+14
-25
lines changed

src/Symfony/Component/Form/Tests/Extension/DataCollector/FormDataExtractorTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -314,12 +314,12 @@ public function testExtractSubmittedDataStoresErrorCause()
314314
-message: "Foo"
315315
-messageTemplate: "Foo"
316316
-parameters: []
317-
-plural: null
318317
-root: "Root"
319318
-propertyPath: "property.path"
320319
-invalidValue: "Invalid!"
321-
-constraint: null
320+
-plural: null
322321
-code: null
322+
-constraint: null
323323
-cause: Exception {%A}
324324
}
325325
1 => Exception {#1}

src/Symfony/Component/Validator/ConstraintViolation.php

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -18,17 +18,6 @@
1818
*/
1919
class ConstraintViolation implements ConstraintViolationInterface
2020
{
21-
private string|\Stringable $message;
22-
private ?string $messageTemplate;
23-
private array $parameters;
24-
private ?int $plural;
25-
private mixed $root;
26-
private ?string $propertyPath;
27-
private mixed $invalidValue;
28-
private ?Constraint $constraint;
29-
private ?string $code;
30-
private mixed $cause;
31-
3221
/**
3322
* Creates a new constraint violation.
3423
*
@@ -49,18 +38,18 @@ class ConstraintViolation implements ConstraintViolationInterface
4938
* caused the violation
5039
* @param mixed $cause The cause of the violation
5140
*/
52-
public function __construct(string|\Stringable $message, ?string $messageTemplate, array $parameters, mixed $root, ?string $propertyPath, mixed $invalidValue, ?int $plural = null, ?string $code = null, ?Constraint $constraint = null, mixed $cause = null)
53-
{
54-
$this->message = $message;
55-
$this->messageTemplate = $messageTemplate;
56-
$this->parameters = $parameters;
57-
$this->plural = $plural;
58-
$this->root = $root;
59-
$this->propertyPath = $propertyPath;
60-
$this->invalidValue = $invalidValue;
61-
$this->constraint = $constraint;
62-
$this->code = $code;
63-
$this->cause = $cause;
41+
public function __construct(
42+
private string|\Stringable $message,
43+
private ?string $messageTemplate,
44+
private array $parameters,
45+
private mixed $root,
46+
private ?string $propertyPath,
47+
private mixed $invalidValue,
48+
private ?int $plural = null,
49+
private ?string $code = null,
50+
private ?Constraint $constraint = null,
51+
private mixed $cause = null,
52+
) {
6453
}
6554

6655
public function __toString(): string

0 commit comments

Comments
 (0)