Skip to content

Commit

Permalink
TASK: Improve docs of FusionContextSerializer
Browse files Browse the repository at this point in the history
  • Loading branch information
mhsdesign committed Feb 11, 2024
1 parent 2a2d068 commit 997f42d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 24 deletions.
14 changes: 3 additions & 11 deletions Neos.Fusion/Classes/Core/Cache/FusionContextSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
/**
* Serializer for Fusion's [at]cache.context values
*
* Uses the flow property mapper as implementation.
* Uses the Flows's property mapper as implementation.
* It relies on a converter being available from the context value type to string and reverse.
*
* {@see RuntimeContentCache::serializeContext()}
Expand Down Expand Up @@ -45,19 +45,11 @@ public function normalize(mixed $object, string $format = null, array $context =

public function supportsDenormalization(mixed $data, string $type, string $format = null)
{
throw new \BadMethodCallException(sprintf('Method %s is not supported.', __METHOD__), 1706978912);
return true;
}

public function supportsNormalization(mixed $data, string $format = null)
{
throw new \BadMethodCallException(sprintf('Method %s is not supported.', __METHOD__), 1706978913);
}

/**
* @return array<int|string,mixed>
*/
public function getSupportedTypes(?string $format): array
{
throw new \BadMethodCallException(sprintf('Method %s is not supported.', __METHOD__), 1706978914);
return true;
}
}
28 changes: 15 additions & 13 deletions Neos.Neos/Classes/Fusion/Cache/NeosFusionContextSerializer.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,20 @@
/**
* Serializer for Fusion's [at]cache.context values
*
* Uses the flow property mapper as implementation.
* It relies on a converter being available from the context value type to string and reverse.
* Implements special handing for serializing {@see Node} objects in fusions cache context:
*
* {@see FusionContextSerializer}
* ```
* [at]cache {
* mode = 'uncached'
* context {
* 1 = 'node'
* }
* }
* ```
*
* The property mapper cannot be relied upon to serialize nodes, as this is willingly not implemented.
*
* Serializing falls back to Fusion's standard {@see FusionContextSerializer} which uses Flow's property mapper.
*
* @internal
*/
Expand Down Expand Up @@ -110,19 +120,11 @@ private function serializeNode(Node $source): array

public function supportsDenormalization(mixed $data, string $type, string $format = null)
{
throw new \BadMethodCallException(sprintf('Method %s is not supported.', __METHOD__), 1706978912);
return true;
}

public function supportsNormalization(mixed $data, string $format = null)
{
throw new \BadMethodCallException(sprintf('Method %s is not supported.', __METHOD__), 1706978913);
}

/**
* @return array<int|string,mixed>
*/
public function getSupportedTypes(?string $format): array
{
throw new \BadMethodCallException(sprintf('Method %s is not supported.', __METHOD__), 1706978914);
return true;
}
}

0 comments on commit 997f42d

Please sign in to comment.