public function sibling()
{
$this->findAnyElement = false;
// Get the nodes at the same level.
if ($this->matches->count() > 0) {
$sibs = new \SplObjectStorage();
foreach ($this->matches as $item) {
/*$candidates = $item->parentNode->childNodes;
foreach ($candidates as $candidate) {
if ($candidate->nodeType === XML_ELEMENT_NODE && $candidate !== $item) {
$sibs->attach($candidate);
}
}
*/
while ($item->nextSibling != null) {
$item = $item->nextSibling;
if ($item->nodeType === XML_ELEMENT_NODE) {
$sibs->attach($item);
}
}
}
$this->matches = $sibs;
}
}