Fix previous merge

This commit is contained in:
Fabien Potencier 2020-09-11 07:20:58 +02:00
parent 7192d29efc
commit 8cb2d296f9
2 changed files with 2 additions and 7 deletions

View File

@ -24,10 +24,6 @@ final class UidNormalizer implements NormalizerInterface, DenormalizerInterface,
*/
public function normalize($object, string $format = null, array $context = [])
{
if (!$object instanceof AbstractUid) {
throw new InvalidArgumentException('The object must be an instance of "Symfony\Component\Uid\AbstractUid".');
}
return (string) $object;
}
@ -45,12 +41,10 @@ final class UidNormalizer implements NormalizerInterface, DenormalizerInterface,
public function denormalize($data, string $type, string $format = null, array $context = [])
{
try {
$uid = Ulid::class === $type ? Ulid::fromString($data) : Uuid::fromString($data);
return Ulid::class === $type ? Ulid::fromString($data) : Uuid::fromString($data);
} catch (\InvalidArgumentException $exception) {
throw new NotNormalizableValueException(sprintf('The data is not a valid "%s" string representation.', $type));
}
return $uid;
}
/**

View File

@ -34,6 +34,7 @@
"symfony/mime": "^4.4|^5.0",
"symfony/property-access": "^4.4|^5.0",
"symfony/property-info": "^4.4|^5.0",
"symfony/uid": "^5.1",
"symfony/validator": "^4.4|^5.0",
"symfony/var-exporter": "^4.4|^5.0",
"symfony/yaml": "^4.4|^5.0"