Skip to content

Commit 55b5e25

Browse files
committed
Apply Vincent's review updates
`src/Serializer/AbstractItemNormalizer.php`: Update constant name Change author phpdoc on test documents and entities
1 parent 6768d2f commit 55b5e25

File tree

6 files changed

+9
-9
lines changed

6 files changed

+9
-9
lines changed

src/JsonLd/Serializer/ItemNormalizer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function normalize($object, $format = null, array $context = [])
6767
{
6868
$objectClass = $this->getObjectClass($object);
6969
$outputClass = $this->getOutputClass($objectClass, $context);
70-
if (null !== $outputClass && !isset($context[self::IS_TRANSFORMED_TO_SAME_CLASS_CONTEXT_KEY])) {
70+
if (null !== $outputClass && !isset($context[self::IS_TRANSFORMED_TO_SAME_CLASS])) {
7171
return parent::normalize($object, $format, $context);
7272
}
7373

src/Serializer/AbstractItemNormalizer.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ abstract class AbstractItemNormalizer extends AbstractObjectNormalizer
5151
use ContextTrait;
5252
use InputOutputMetadataTrait;
5353

54-
public const IS_TRANSFORMED_TO_SAME_CLASS_CONTEXT_KEY = 'is_transformed_to_same_class';
54+
public const IS_TRANSFORMED_TO_SAME_CLASS = 'is_transformed_to_same_class';
5555

5656
protected $propertyNameCollectionFactory;
5757
protected $propertyMetadataFactory;
@@ -114,7 +114,7 @@ public function hasCacheableSupportsMethod(): bool
114114
*/
115115
public function normalize($object, $format = null, array $context = [])
116116
{
117-
if (!($isTransformed = isset($context[self::IS_TRANSFORMED_TO_SAME_CLASS_CONTEXT_KEY])) && $outputClass = $this->getOutputClass($this->getObjectClass($object), $context)) {
117+
if (!($isTransformed = isset($context[self::IS_TRANSFORMED_TO_SAME_CLASS])) && $outputClass = $this->getOutputClass($this->getObjectClass($object), $context)) {
118118
if (!$this->serializer instanceof NormalizerInterface) {
119119
throw new LogicException('Cannot normalize the output because the injected serializer is not a normalizer');
120120
}
@@ -124,13 +124,13 @@ public function normalize($object, $format = null, array $context = [])
124124
$context['api_resource'] = $object;
125125
unset($context['output'], $context['resource_class']);
126126
} else {
127-
$context[self::IS_TRANSFORMED_TO_SAME_CLASS_CONTEXT_KEY] = true;
127+
$context[self::IS_TRANSFORMED_TO_SAME_CLASS] = true;
128128
}
129129

130130
return $this->serializer->normalize($transformed, $format, $context);
131131
}
132132
if ($isTransformed) {
133-
unset($context[self::IS_TRANSFORMED_TO_SAME_CLASS_CONTEXT_KEY]);
133+
unset($context[self::IS_TRANSFORMED_TO_SAME_CLASS]);
134134
}
135135

136136
$resourceClass = $this->resourceClassResolver->getResourceClass($object, $context['resource_class'] ?? null);

tests/Fixtures/TestBundle/Document/DummyDtoOutputFallbackToSameClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/**
2121
* Dummy InputOutput.
2222
*
23-
* @author Kévin Dunglas <[email protected]>
23+
* @author Daniel West <[email protected]>
2424
*
2525
* @ApiResource(attributes={"output"=OutputDtoDummy::class})
2626
* @ODM\Document

tests/Fixtures/TestBundle/Document/DummyDtoOutputSameClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* Dummy InputOutput.
2121
*
22-
* @author Kévin Dunglas <[email protected]>
22+
* @author Daniel West <[email protected]>
2323
*
2424
* @ApiResource(attributes={"output"=DummyDtoOutputSameClass::class})
2525
* @ODM\Document

tests/Fixtures/TestBundle/Entity/DummyDtoOutputFallbackToSameClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
/**
2121
* Dummy InputOutput.
2222
*
23-
* @author Kévin Dunglas <[email protected]>
23+
* @author Daniel West <[email protected]>
2424
*
2525
* @ApiResource(attributes={"output"=OutputDtoDummy::class})
2626
* @ORM\Entity

tests/Fixtures/TestBundle/Entity/DummyDtoOutputSameClass.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
/**
2020
* Dummy InputOutput.
2121
*
22-
* @author Kévin Dunglas <[email protected]>
22+
* @author Daniel West <[email protected]>
2323
*
2424
* @ApiResource(attributes={"output"=DummyDtoOutputSameClass::class})
2525
* @ORM\Entity

0 commit comments

Comments
 (0)