The replaceChild()
method replaces an existing child node with a new node. The old node is removed and the new node takes its place. This method returns the replaced (old) node if successful.
Description
public AbstractNode::replaceChild(NodeInterface $newNode, NodeInterface $oldNode): ?NodeInterface
Parameters
newNode
The node to insert in place of the old node.
oldNode
The node to be replaced by the new node.
Return Value
Returns the replaced NodeInterface
instance if successful, or null
if the oldNode
was not found as a child.
Exceptions
None