Patchwork\CodeManipulation\Source::nextSibling PHP Method

nextSibling() public method

public nextSibling ( $types, $offset )
    function nextSibling($types, $offset)
    {
        $level = $this->levels[$offset];
        $end = Utils\firstGreaterThan(Utils\access($this->levelEndings, $level, []), $offset);
        if ($types === self::ANY) {
            return Utils\firstGreaterThan($this->tokensByLevel[$level], $offset);
        } else {
            $next = INF;
            foreach ((array) $types as $type) {
                $candidates = Utils\access($this->tokensByLevelAndType, [$level, $type], []);
                $next = min(Utils\firstGreaterThan($candidates, $offset), $next);
            }
            return $next < $endpoint ? $next : INF;
        }
    }