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

[Serializer] Change visibility of Serializer::getNormalizer and ::getDenormalizer from private to protected #52084

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 3 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
Next Next commit
Change visibility of getNormalizer and getDenormalizer
  • Loading branch information
bradjones1 committed Oct 16, 2023
commit cedfa9c6e3925195b6d3ea335dba0bff7d179111
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,16 @@ interface DenormalizerInterface
*/
public function denormalize(mixed $data, string $type, string $format = null, array $context = []);

/**
* Returns a matching denormalizer.
*
* @param mixed $data Data to restore
* @param string $class The expected class to instantiate
* @param string|null $format Format name, present to give the option to normalizers to act differently based on formats
* @param array $context Options available to the denormalizer
*/
public function getDenormalizer(mixed $data, string $class, ?string $format, array $context): ?DenormalizerInterface;

/**
* Checks whether the given class is supported for denormalization by this normalizer.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ interface NormalizerInterface
*/
public function normalize(mixed $object, string $format = null, array $context = []);

/**
* Returns a matching normalizer.
*
* @param mixed $data Data to get the serializer for
* @param string|null $format Format name, present to give the option to normalizers to act differently based on formats
* @param array $context Options available to the normalizer
*/
public function getNormalizer(mixed $data, ?string $format, array $context): ?NormalizerInterface;

/**
* Checks whether the given class is supported for normalization by this normalizer.
*
Expand Down
19 changes: 2 additions & 17 deletions 19 src/Symfony/Component/Serializer/Serializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,7 @@ public function supportsDenormalization(mixed $data, string $type, string $forma
return isset(self::SCALAR_TYPES[$type]) || null !== $this->getDenormalizer($data, $type, $format, $context);
}

/**
* Returns a matching normalizer.
*
* @param mixed $data Data to get the serializer for
* @param string|null $format Format name, present to give the option to normalizers to act differently based on formats
* @param array $context Options available to the normalizer
*/
private function getNormalizer(mixed $data, ?string $format, array $context): ?NormalizerInterface
public function getNormalizer(mixed $data, ?string $format, array $context): ?NormalizerInterface
{
if (\is_object($data)) {
$type = $data::class;
Expand Down Expand Up @@ -325,15 +318,7 @@ private function getNormalizer(mixed $data, ?string $format, array $context): ?N
return null;
}

/**
* Returns a matching denormalizer.
*
* @param mixed $data Data to restore
* @param string $class The expected class to instantiate
* @param string|null $format Format name, present to give the option to normalizers to act differently based on formats
* @param array $context Options available to the denormalizer
*/
private function getDenormalizer(mixed $data, string $class, ?string $format, array $context): ?DenormalizerInterface
public function getDenormalizer(mixed $data, string $class, ?string $format, array $context): ?DenormalizerInterface
{
if (!isset($this->denormalizerCache[$format][$class])) {
$this->denormalizerCache[$format][$class] = [];
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.