src/Fixer/LineLength/LineLengthFixer.php
private function matchNamePositionForEndOfFunctionCall(Tokens $tokens, int $position): ?int
    {
        try {
            $blockStart = $tokens->findBlockStart(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $position);
        } catch (Throwable $throwable) {
            // not a block start
            return null;
        }

        $previousTokenPosition = $blockStart - 1;
        $possibleMethodNameToken = $tokens[$previousTokenPosition];

        // not a "methodCall()"
        if (! $possibleMethodNameToken->isGivenKind(T_STRING)) {
            return null;
        }

        // starts with small letter?
        $methodOrFunctionName = $possibleMethodNameToken->getContent();
        if (! ctype_lower($methodOrFunctionName[0])) {
            return null;
        }

        // is "someCall()"? we don't care, there are no arguments
        if ($tokens[$blockStart + 1]->equals(')')) {
            return null;
        }

        return $previousTokenPosition;
    }
private function matchNamePositionForEndOfFunctionCall(Tokens $tokens, int $position): ?int
    {
        try {
            $blockStart = $tokens->findBlockStart(Tokens::BLOCK_TYPE_PARENTHESIS_BRACE, $position);
        } catch (Throwable $throwable) {
            // not a block start
            return null;
        }

        $previousTokenPosition = $blockStart - 1;
        $possibleMethodNameToken = $tokens[$previousTokenPosition];

        // not a "methodCall()"
        if (! $possibleMethodNameToken->isGivenKind(T_STRING)) {
            return null;
        }

        // starts with small letter?
        $methodOrFunctionName = $possibleMethodNameToken->getContent();
        if (! ctype_lower($methodOrFunctionName[0])) {
            return null;
        }

        // is "someCall()"? we don't care, there are no arguments
        if ($tokens[$blockStart + 1]->equals(')')) {
            return null;
        }

        return $previousTokenPosition;
    }
private function matchNamePositionForEndOfFunctionCall ( Tokens $ tokens , int $ position ) : ? int { try { $ blockStart = $ tokens -> findBlockStart ( Tokens :: BLOCK_TYPE_PARENTHESIS_BRACE , $ position ) ; } catch ( Throwable $ throwable ) { // not a block start return null ; } $ previousTokenPosition = $ blockStart - 1 ; $ possibleMethodNameToken = $ tokens [ $ previousTokenPosition ] ; // not a "methodCall()" if ( ! $ possibleMethodNameToken -> isGivenKind ( T_STRING ) ) { return null ; } // starts with small letter? $ methodOrFunctionName = $ possibleMethodNameToken -> getContent ( ) ; if ( ! ctype_lower ( $ methodOrFunctionName [ 0 ] ) ) { return null ; } // is "someCall()"? we don't care, there are no arguments if ( $ tokens [ $ blockStart + 1 ] -> equals ( ')' ) ) { return null ; } return $ previousTokenPosition ; }
We go through tokens from down to up,
so we need to find ")" and then the start of function
We go through tokens from down to up so we need to find ) and then the start of function