From 690fca45f6dbeb7f4584e22ed8c7a4af5a0ed2d8 Mon Sep 17 00:00:00 2001 From: mhsdesign <85400359+mhsdesign@users.noreply.github.com> Date: Sat, 2 Sep 2023 11:12:03 +0200 Subject: [PATCH] TASK: document and assert Node.nodeName behavior related https://github.com/neos/neos-development-collection/issues/4311 --- .../Classes/Projection/ContentGraph/Node.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php index d29f4191ec9..8774826cbcc 100644 --- a/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php +++ b/Neos.ContentRepository.Core/Classes/Projection/ContentGraph/Node.php @@ -44,7 +44,7 @@ * @param NodeTypeName $nodeTypeName The node's node type name; always set, even if unknown to the NodeTypeManager * @param NodeType|null $nodeType The node's node type, null if unknown to the NodeTypeManager - @deprecated Don't rely on this too much, as the capabilities of the NodeType here will probably change a lot; Ask the {@see NodeTypeManager} instead * @param PropertyCollection $properties All properties of this node. References are NOT part of this API; To access references, {@see ContentSubgraphInterface::findReferences()} can be used; To read the serialized properties, call properties->serialized(). - * @param NodeName|null $nodeName The optional name of this node {@see ContentSubgraphInterface::findChildNodeConnectedThroughEdgeName()} + * @param NodeName|null $nodeName The nodeƄs name. The name is guaranteed to be for tethered nodes. For the regular classification, it can be set optionally. One can traverse the edges via {@see ContentSubgraphInterface::findChildNodeConnectedThroughEdgeName()}. * @param Timestamps $timestamps Creation and modification timestamps of this node */ private function __construct( @@ -58,6 +58,9 @@ private function __construct( public ?NodeName $nodeName, public Timestamps $timestamps, ) { + if ($this->classification->isTethered() && $this->nodeName === null) { + throw new \InvalidArgumentException('The NodeName must be set if the Node is tethered.', 1695118377); + } } /**