src/Tokenizer/Tokens.php
public function getTokenNotOfKindSibling($index, $direction, array $tokens = [])
    {
        while (true) {
            $index += $direction;

            if (!$this->offsetExists($index)) {
                return null;
            }

            if ($this->isEmptyAt($index)) {
                continue;
            }

            if ($this[$index]->equalsAny($tokens)) {
                continue;
            }

            return $index;
        }
    }
public function getTokenNotOfKindSibling($index, $direction, array $tokens = [])
    {
        while (true) {
            $index += $direction;

            if (!$this->offsetExists($index)) {
                return null;
            }

            if ($this->isEmptyAt($index)) {
                continue;
            }

            if ($this[$index]->equalsAny($tokens)) {
                continue;
            }

            return $index;
        }
    }
Get index for closest sibling token not of given kind.

@param int   $index     token index
@param int   $direction direction for looking, +1 or -1
@param array $tokens    possible tokens

@return null|int