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

Breadcrumb

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

function AbstractScopeSniff::process

Processes the tokens that this test is listening for.

Parameters

\PHP_CodeSniffer\Files\File $phpcsFile The file where this token was found.:

int $stackPtr The position in the stack where this: token was found.

Return value

void|int Optionally returns a stack pointer. The sniff will not be called again on the current file until the returned stack pointer is reached. Return `$phpcsFile->numTokens` to skip the rest of the file.

Overrides Sniff::process

See also

processTokenWithinScope()

File

vendor/squizlabs/php_codesniffer/src/Sniffs/AbstractScopeSniff.php, line 130

Class

AbstractScopeSniff

Namespace

PHP_CodeSniffer\Sniffs

Code

public final function process(File $phpcsFile, $stackPtr) {
    $tokens = $phpcsFile->getTokens();
    $foundScope = false;
    $skipTokens = [];
    foreach ($tokens[$stackPtr]['conditions'] as $scope => $code) {
        if (isset($this->scopeTokens[$code]) === true) {
            $skipTokens[] = $this->processTokenWithinScope($phpcsFile, $stackPtr, $scope);
            $foundScope = true;
        }
    }
    if ($this->listenOutside === true && $foundScope === false) {
        $skipTokens[] = $this->processTokenOutsideScope($phpcsFile, $stackPtr);
    }
    if (empty($skipTokens) === false) {
        return min($skipTokens);
    }
}

API Navigation

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