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

Commit 3f46692

Browse filesBrowse files
committed
adjust to feedback
1 parent 6229254 commit 3f46692
Copy full SHA for 3f46692

File tree

2 files changed

+14
-11
lines changed
Filter options

2 files changed

+14
-11
lines changed

‎src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractNormalizer.php
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ abstract class AbstractNormalizer implements NormalizerInterface, DenormalizerIn
111111
*/
112112
public const IGNORED_ATTRIBUTES = 'ignored_attributes';
113113

114+
/**
115+
* @internal
116+
*/
114117
protected const CIRCULAR_REFERENCE_LIMIT_COUNTERS = 'circular_reference_limit_counters';
115118

116119
protected $defaultContext = [

‎src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php

Copy file name to clipboardExpand all lines: src/Symfony/Component/Serializer/Normalizer/AbstractObjectNormalizer.php
+11-11Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -147,38 +147,38 @@ public function normalize($object, $format = null, array $context = [])
147147
$attributesMetadata = $this->classMetadataFactory ? $this->classMetadataFactory->getMetadataFor($class)->getAttributesMetadata() : null;
148148
$maxDepthHandler = $context[self::MAX_DEPTH_HANDLER] ?? $this->defaultContext[self::MAX_DEPTH_HANDLER] ?? $this->maxDepthHandler;
149149

150-
foreach ($attributes as $attributeName) {
150+
foreach ($attributes as $attribute) {
151151
$maxDepthReached = false;
152-
if (null !== $attributesMetadata && ($maxDepthReached = $this->isMaxDepthReached($attributesMetadata, $class, $attributeName, $context)) && !$maxDepthHandler) {
152+
if (null !== $attributesMetadata && ($maxDepthReached = $this->isMaxDepthReached($attributesMetadata, $class, $attribute, $context)) && !$maxDepthHandler) {
153153
continue;
154154
}
155155

156-
$attributeValue = $this->getAttributeValue($object, $attributeName, $format, $context);
156+
$attributeValue = $this->getAttributeValue($object, $attribute, $format, $context);
157157
if ($maxDepthReached) {
158-
$attributeValue = $maxDepthHandler($attributeValue, $object, $attributeName, $format, $context);
158+
$attributeValue = $maxDepthHandler($attributeValue, $object, $attribute, $format, $context);
159159
}
160160

161161
/**
162162
* @var callable|null
163163
*/
164-
$callback = $context[self::CALLBACKS][$attributeName] ?? $this->defaultContext[self::CALLBACKS][$attributeName] ?? $this->callbacks[$attributeName] ?? null;
164+
$callback = $context[self::CALLBACKS][$attribute] ?? $this->defaultContext[self::CALLBACKS][$attribute] ?? $this->callbacks[$attribute] ?? null;
165165
if ($callback) {
166-
$attributeValue = $callback($attributeValue, $object, $attributeName, $format, $context);
166+
$attributeValue = $callback($attributeValue, $object, $attribute, $format, $context);
167167
}
168168

169169
if (null !== $attributeValue && !is_scalar($attributeValue)) {
170-
$stack[$attributeName] = $attributeValue;
170+
$stack[$attribute] = $attributeValue;
171171
}
172172

173-
$data = $this->updateData($data, $attributeName, $attributeValue, $class, $format, $context);
173+
$data = $this->updateData($data, $attribute, $attributeValue, $class, $format, $context);
174174
}
175175

176-
foreach ($stack as $attributeName => $attributeValue) {
176+
foreach ($stack as $attribute => $attributeValue) {
177177
if (!$this->serializer instanceof NormalizerInterface) {
178-
throw new LogicException(sprintf('Cannot normalize attribute "%s" because the injected serializer is not a normalizer', $attributeName));
178+
throw new LogicException(sprintf('Cannot normalize attribute "%s" because the injected serializer is not a normalizer', $attribute));
179179
}
180180

181-
$data = $this->updateData($data, $attributeName, $this->serializer->normalize($attributeValue, $format, $this->createChildContext($context, $attributeName)), $class, $format, $context);
181+
$data = $this->updateData($data, $attribute, $this->serializer->normalize($attributeValue, $format, $this->createChildContext($context, $attribute)), $class, $format, $context);
182182
}
183183

184184
return $data;

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.