Skip to content

Commit cf55690

Browse files
committed
Revert "fix(symfony): use Type constraint violation code instead of exception code (#6037)"
This reverts commit aae0dbf.
1 parent cc16a1c commit cf55690

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/Symfony/EventListener/DeserializeListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public function onKernelRequest(RequestEvent $event): void
111111
if ($exception->canUseMessageForUser()) {
112112
$parameters['hint'] = $exception->getMessage();
113113
}
114-
$violations->add(new ConstraintViolation($this->translator->trans($message, ['{{ type }}' => implode('|', $exception->getExpectedTypes() ?? [])], 'validators'), $message, $parameters, null, $exception->getPath(), null, null, Type::INVALID_TYPE_ERROR));
114+
$violations->add(new ConstraintViolation($this->translator->trans($message, ['{{ type }}' => implode('|', $exception->getExpectedTypes() ?? [])], 'validators'), $message, $parameters, null, $exception->getPath(), null, null, (string) $exception->getCode()));
115115
}
116116
if (0 !== \count($violations)) {
117117
throw new ValidationException($violations);

tests/Symfony/EventListener/DeserializeListenerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public function testTurnPartialDenormalizationExceptionIntoValidationException()
366366
$this->assertSame($violation->getPropertyPath(), 'foo');
367367
$this->assertNull($violation->getInvalidValue());
368368
$this->assertNull($violation->getPlural());
369-
$this->assertSame($violation->getCode(), 'ba785a8c-82cb-4283-967c-3cf342181b40');
369+
$this->assertSame($violation->getCode(), '0');
370370
}
371371
}
372372
}

0 commit comments

Comments
 (0)