src/Collection/Tree/RedBlackSearchTree.php
protected function nodeCeiling($key, ?RedBlackNode $node): ?RedBlackNode
    {
        if ($node === null) {
            return null;
        }

        $comp = $this->comparator->compare($key, $node->key());

        if ($comp === 0) {
            return $node;
        }
        if ($comp > 0) {
            return $this->nodeCeiling($key, $node->right());
        }
        $left = $this->nodeCeiling($key, $node->left());
        if ($left !== null) {
            return $left;
        }

        return $node;
    }
protected function nodeCeiling($key, ?RedBlackNode $node): ?RedBlackNode
    {
        if ($node === null) {
            return null;
        }

        $comp = $this->comparator->compare($key, $node->key());

        if ($comp === 0) {
            return $node;
        }
        if ($comp > 0) {
            return $this->nodeCeiling($key, $node->right());
        }
        $left = $this->nodeCeiling($key, $node->left());
        if ($left !== null) {
            return $left;
        }

        return $node;
    }
protected function nodeCeiling ( $ key , ? RedBlackNode $ node ) : ? RedBlackNode { if ( $ node === null ) { return null ; } $ comp = $ this -> comparator -> compare ( $ key , $ node -> key ( ) ) ; if ( $ comp === 0 ) { return $ node ; } if ( $ comp > 0 ) { return $ this -> nodeCeiling ( $ key , $ node -> right ( ) ) ; } $ left = $ this -> nodeCeiling ( $ key , $ node -> left ( ) ) ; if ( $ left !== null ) { return $ left ; } return $ node ; }
Retrieves the node with the smallest key >= to a key in a subtree

Returns null if there is not a key less or equal to the given key.

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

@return RedBlackNode|null
Retrieves the node with the smallest key > = to a key in a subtree