public function doesFunctionCallHaveParameters(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        // Check for the existence of the token.
        if (isset($tokens[$stackPtr]) === false) {
            return false;
        }

        // Is this one of the tokens this function handles ?
        if (\in_array($tokens[$stackPtr]['code'], array(\T_STRING, \T_ARRAY, \T_OPEN_SHORT_ARRAY, \T_VARIABLE), true) === false) {
            return false;
        }

        $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);

        // Deal with short array syntax.
        if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) {
            if (isset($tokens[$stackPtr]['bracket_closer']) === false) {
                return false;
            }

            if ($nextNonEmpty === $tokens[$stackPtr]['bracket_closer']) {
                // No parameters.
                return false;
            } else {
                return true;
            }
        }

        // Deal with function calls & long arrays.
        // Next non-empty token should be the open parenthesis.
        if ($nextNonEmpty === false && $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) {
            return false;
        }

        if (isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false) {
            return false;
        }

        $closeParenthesis = $tokens[$nextNonEmpty]['parenthesis_closer'];
        $nextNextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $nextNonEmpty + 1, $closeParenthesis + 1, true);

        if ($nextNextNonEmpty === $closeParenthesis) {
            // No parameters.
            return false;
        }

        return true;
    }
public function doesFunctionCallHaveParameters(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        // Check for the existence of the token.
        if (isset($tokens[$stackPtr]) === false) {
            return false;
        }

        // Is this one of the tokens this function handles ?
        if (\in_array($tokens[$stackPtr]['code'], array(\T_STRING, \T_ARRAY, \T_OPEN_SHORT_ARRAY, \T_VARIABLE), true) === false) {
            return false;
        }

        $nextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);

        // Deal with short array syntax.
        if ($tokens[$stackPtr]['code'] === \T_OPEN_SHORT_ARRAY) {
            if (isset($tokens[$stackPtr]['bracket_closer']) === false) {
                return false;
            }

            if ($nextNonEmpty === $tokens[$stackPtr]['bracket_closer']) {
                // No parameters.
                return false;
            } else {
                return true;
            }
        }

        // Deal with function calls & long arrays.
        // Next non-empty token should be the open parenthesis.
        if ($nextNonEmpty === false && $tokens[$nextNonEmpty]['code'] !== \T_OPEN_PARENTHESIS) {
            return false;
        }

        if (isset($tokens[$nextNonEmpty]['parenthesis_closer']) === false) {
            return false;
        }

        $closeParenthesis = $tokens[$nextNonEmpty]['parenthesis_closer'];
        $nextNextNonEmpty = $phpcsFile->findNext(Tokens::$emptyTokens, $nextNonEmpty + 1, $closeParenthesis + 1, true);

        if ($nextNextNonEmpty === $closeParenthesis) {
            // No parameters.
            return false;
        }

        return true;
    }
public function doesFunctionCallHaveParameters ( File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; // Check for the existence of the token. if ( isset ( $ tokens [ $ stackPtr ] ) === false ) { return false ; } // Is this one of the tokens this function handles ? if ( \ in_array ( $ tokens [ $ stackPtr ] [ 'code' ] , array ( \ T_STRING , \ T_ARRAY , \ T_OPEN_SHORT_ARRAY , \ T_VARIABLE ) , true ) === false ) { return false ; } $ nextNonEmpty = $ phpcsFile -> findNext ( Tokens :: $ emptyTokens , $ stackPtr + 1 , null , true , null , true ) ; // Deal with short array syntax. if ( $ tokens [ $ stackPtr ] [ 'code' ] === \ T_OPEN_SHORT_ARRAY ) { if ( isset ( $ tokens [ $ stackPtr ] [ 'bracket_closer' ] ) === false ) { return false ; } if ( $ nextNonEmpty === $ tokens [ $ stackPtr ] [ 'bracket_closer' ] ) { // No parameters. return false ; } else { return true ; } } // Deal with function calls & long arrays. // Next non-empty token should be the open parenthesis. if ( $ nextNonEmpty === false && $ tokens [ $ nextNonEmpty ] [ 'code' ] !== \ T_OPEN_PARENTHESIS ) { return false ; } if ( isset ( $ tokens [ $ nextNonEmpty ] [ 'parenthesis_closer' ] ) === false ) { return false ; } $ closeParenthesis = $ tokens [ $ nextNonEmpty ] [ 'parenthesis_closer' ] ; $ nextNextNonEmpty = $ phpcsFile -> findNext ( Tokens :: $ emptyTokens , $ nextNonEmpty + 1 , $ closeParenthesis + 1 , true ) ; if ( $ nextNextNonEmpty === $ closeParenthesis ) { // No parameters. return false ; } return true ; }
Checks if a function call has parameters.

Expects to be passed the T_STRING or T_VARIABLE stack pointer for the function call.
If passed a T_STRING which is *not* a function call, the behaviour is unreliable.

Extra feature: If passed an T_ARRAY or T_OPEN_SHORT_ARRAY stack pointer, it
will detect whether the array has values or is empty.

@link https://github.com/PHPCompatibility/PHPCompatibility/issues/120
@link https://github.com/PHPCompatibility/PHPCompatibility/issues/152

@param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param int                   $stackPtr  The position of the function call token.

@return bool
Checks if a function call has parameters .