Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. Helpers.php

function Helpers::findFunctionCall

* Return the index of a function's name token from inside the function. * * $stackPtr must be inside the function body or parameters for this to work. * *

Parameters

File $phpcsFile: * @param int $stackPtr * * @return ?int

2 calls to Helpers::findFunctionCall()
Helpers::findFunctionCallArguments in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Lib/Helpers.php
*
VariableAnalysisSniff::processVariableAsPassByReferenceFunctionCall in vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Sniffs/CodeAnalysis/VariableAnalysisSniff.php
*

File

vendor/sirbrillig/phpcs-variable-analysis/VariableAnalysis/Lib/Helpers.php, line 314

Class

Helpers

Namespace

VariableAnalysis\Lib

Code

public static function findFunctionCall(File $phpcsFile, $stackPtr) {
    $tokens = $phpcsFile->getTokens();
    $openPtr = self::findContainingOpeningBracket($phpcsFile, $stackPtr);
    if (is_int($openPtr)) {
        // First non-whitespace thing and see if it's a T_STRING function name
        $functionPtr = $phpcsFile->findPrevious(Tokens::$emptyTokens, $openPtr - 1, null, true, null, true);
        if (is_int($functionPtr) && $tokens[$functionPtr]['code'] === T_STRING) {
            return $functionPtr;
        }
    }
    return null;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal