You are here

function VariableAnalysisSniff::findFunctionCall in Coder 8.2

Checks if the given pointer is in a function call.

Parameters

\PHP_CodeSniffer\Files\File $phpcsFile:

int $stackPtr:

Return value

int|false

2 calls to VariableAnalysisSniff::findFunctionCall()
VariableAnalysisSniff::checkForPassByReferenceFunctionCall in coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
Check if this is a "&" function call.
VariableAnalysisSniff::findFunctionCallArguments in coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
Get the arguments of a function call.

File

coder_sniffer/DrupalPractice/Sniffs/CodeAnalysis/VariableAnalysisSniff.php, line 1120

Class

VariableAnalysisSniff
Checks the for undefined function variables.

Namespace

DrupalPractice\Sniffs\CodeAnalysis

Code

function findFunctionCall(File $phpcsFile, $stackPtr) {
  $tokens = $phpcsFile
    ->getTokens();
  if (($openPtr = $this
    ->findContainingBrackets($phpcsFile, $stackPtr)) !== false) {

    // First non-whitespace thing and see if it's a T_STRING function name.
    $functionPtr = $phpcsFile
      ->findPrevious(T_WHITESPACE, $openPtr - 1, null, true, null, true);
    if ($tokens[$functionPtr]['code'] === T_STRING) {
      return $functionPtr;
    }
  }
  return false;
}