src/SignatureHelpProvider.php
private function findActiveParameter(
        Node\DelimitedList\ArgumentExpressionList $argumentExpressionList,
        Position $position,
        PhpDocument $doc
    ): int {
        $args = $argumentExpressionList->children;
        $i = 0;
        $found = null;
        foreach ($args as $arg) {
            if ($arg instanceof Node) {
                $start = $arg->getFullStart();
                $end = $arg->getEndPosition();
            } else {
                $start = $arg->fullStart;
                $end = $start + $arg->length;
            }
            $offset = $position->toOffset($doc->getContent());
            if ($offset >= $start && $offset <= $end) {
                $found = $i;
                break;
            }
            if ($arg instanceof Node) {
                ++$i;
            }
        }
        if ($found === null) {
            $found = $i;
        }
        return $found;
    }
private function findActiveParameter(
        Node\DelimitedList\ArgumentExpressionList $argumentExpressionList,
        Position $position,
        PhpDocument $doc
    ): int {
        $args = $argumentExpressionList->children;
        $i = 0;
        $found = null;
        foreach ($args as $arg) {
            if ($arg instanceof Node) {
                $start = $arg->getFullStart();
                $end = $arg->getEndPosition();
            } else {
                $start = $arg->fullStart;
                $end = $start + $arg->length;
            }
            $offset = $position->toOffset($doc->getContent());
            if ($offset >= $start && $offset <= $end) {
                $found = $i;
                break;
            }
            if ($arg instanceof Node) {
                ++$i;
            }
        }
        if ($found === null) {
            $found = $i;
        }
        return $found;
    }
private function findActiveParameter ( Node \ DelimitedList \ ArgumentExpressionList $ argumentExpressionList , Position $ position , PhpDocument $ doc ) : int { $ args = $ argumentExpressionList -> children ; $ i = 0 ; $ found = null ; foreach ( $ args as $ arg ) { if ( $ arg instanceof Node ) { $ start = $ arg -> getFullStart ( ) ; $ end = $ arg -> getEndPosition ( ) ; } else { $ start = $ arg -> fullStart ; $ end = $ start + $ arg -> length ; } $ offset = $ position -> toOffset ( $ doc -> getContent ( ) ) ; if ( $ offset >= $ start && $ offset <= $ end ) { $ found = $ i ; break ; } if ( $ arg instanceof Node ) { ++ $ i ; } } if ( $ found === null ) { $ found = $ i ; } return $ found ; }
Given a position and arguments, finds the "active" argument at the position

@param Node\DelimitedList\ArgumentExpressionList $argumentExpressionList The argument expression list
@param Position                                  $position               The position to detect the active argument from
@param PhpDocument                               $doc                    The document that contains the expression

@return int
Given a position and arguments finds the active argument at the position