src/PhpCodeFixer.php
public static function makeFunctionCallTree(array $tokens) {
        $tree = [];
        $braces_level = 0;
        $i = 1;

        while (/*$braces > 0 &&*/ isset($tokens[$i])) {
            if ($tokens[$i] == '(') $braces_level++;
            else if ($tokens[$i] == ')') $braces_level--;
            else $tree[$braces_level][] = $tokens[$i];
            $i++;
        }
        return $tree;
    }
public static function makeFunctionCallTree(array $tokens) {
        $tree = [];
        $braces_level = 0;
        $i = 1;

        while (/*$braces > 0 &&*/ isset($tokens[$i])) {
            if ($tokens[$i] == '(') $braces_level++;
            else if ($tokens[$i] == ')') $braces_level--;
            else $tree[$braces_level][] = $tokens[$i];
            $i++;
        }
        return $tree;
    }
Creates a tokens hierarchy by () from plain list
@param array $tokens
@return array