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

Breadcrumb

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

function FunctionCall::process

Processes this test, when one of its tokens is encountered.

Parameters

\PHP_CodeSniffer\Files\File $phpcsFile The file being scanned.:

int $stackPtr The position of the current token: in the stack passed in $tokens.

Return value

void

Overrides Sniff::process

2 methods override FunctionCall::process()
GlobalFunctionSniff::process in vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/Objects/GlobalFunctionSniff.php
Processes this test, when one of its tokens is encountered.
ThemeSniff::process in vendor/drupal/coder/coder_sniffer/DrupalPractice/Sniffs/FunctionCalls/ThemeSniff.php
Processes this function call.

File

vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Semantics/FunctionCall.php, line 91

Class

FunctionCall
Helper class to sniff for specific function calls.

Namespace

Drupal\Sniffs\Semantics

Code

public function process(File $phpcsFile, $stackPtr) {
    $tokens = $phpcsFile->getTokens();
    $functionName = $tokens[$stackPtr]['content'];
    if (in_array($functionName, $this->registerFunctionNames()) === false) {
        // Not interested in this function.
        return;
    }
    if ($this->isFunctionCall($phpcsFile, $stackPtr) === false) {
        return;
    }
    // Find the next non-empty token.
    $openBracket = $phpcsFile->findNext(Tokens::$emptyTokens, $stackPtr + 1, null, true);
    $this->phpcsFile = $phpcsFile;
    $this->functionCall = $stackPtr;
    $this->openBracket = $openBracket;
    $this->closeBracket = $tokens[$openBracket]['parenthesis_closer'];
    $this->arguments = [];
    $this->processFunctionCall($phpcsFile, $stackPtr, $openBracket, $this->closeBracket);
}
RSS feed
Powered by Drupal