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

[FWB][Serializer][Form][Validator] Uid integration #36317

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 33 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
DocBlocks.
  • Loading branch information
Guillaume Pédelagrabe committed Apr 8, 2020
commit ae3cc5bd8e5799b92a5e9db415269d61cd3fd404
19 changes: 19 additions & 0 deletions 19 src/Symfony/Component/Serializer/Normalizer/UidNormalizer.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

class UidNormalizer implements NormalizerInterface, DenormalizerInterface, CacheableSupportsMethodInterface
{
/**
* {@inheritdoc}
*
* @throws InvalidArgumentException
*/
public function normalize($object, string $format = null, array $context = [])
{
if (!$object instanceof AbstractUid) {
Expand All @@ -19,11 +24,19 @@ public function normalize($object, string $format = null, array $context = [])
return (string) $object;
}

/**
* {@inheritdoc}
*/
public function supportsNormalization($data, string $format = null)
{
return $data instanceof AbstractUid;
}

/**
* {@inheritdoc}
*
* @throws NotNormalizableValueException
*/
public function denormalize($data, string $type, string $format = null, array $context = [])
{
try {
Expand All @@ -35,6 +48,9 @@ public function denormalize($data, string $type, string $format = null, array $c
return $uid;
}

/**
* {@inheritdoc}
*/
public function supportsDenormalization($data, string $type, string $format = null)
{
try {
Expand All @@ -46,6 +62,9 @@ public function supportsDenormalization($data, string $type, string $format = nu
return $class->isSubclassOf(AbstractUid::class) || AbstractUid::class === $class->getName();
}

/**
* {@inheritdoc}
*/
public function hasCacheableSupportsMethod(): bool
{
return __CLASS__ === static::class;
Expand Down
3 changes: 3 additions & 0 deletions 3 src/Symfony/Component/Validator/Constraints/UidValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@

class UidValidator extends ConstraintValidator
{
/**
* {@inheritdoc}
*/
public function validate($value, Constraint $constraint)
{
if (!$constraint instanceof Uid) {
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.