src/Collection/Tree/RedBlackSearchTree.php
protected function nodeGet($key, ?RedBlackNode $node): ?RedBlackNode
    {
        while ($node !== null) {
            $comp = $this->comparator->compare($key, $node->key());
            if ($comp < 0) {
                $node = $node->left();
            } elseif ($comp > 0) {
                $node = $node->right();
            } else {
                return $node;
            }
        }

        return null;
    }
protected function nodeGet($key, ?RedBlackNode $node): ?RedBlackNode
    {
        while ($node !== null) {
            $comp = $this->comparator->compare($key, $node->key());
            if ($comp < 0) {
                $node = $node->left();
            } elseif ($comp > 0) {
                $node = $node->right();
            } else {
                return $node;
            }
        }

        return null;
    }
protected function nodeGet ( $ key , ? RedBlackNode $ node ) : ? RedBlackNode { while ( $ node !== null ) { $ comp = $ this -> comparator -> compare ( $ key , $ node -> key ( ) ) ; if ( $ comp < 0 ) { $ node = $ node -> left ( ) ; } elseif ( $ comp > 0 ) { $ node = $ node -> right ( ) ; } else { return $ node ; } } return null ; }
Retrieves a node by key and subtree

Returns null if the node is not found.

@param mixed             $key  The key
@param RedBlackNode|null $node The subtree root

@return RedBlackNode|null
Retrieves a node by key and subtree