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

Breadcrumb

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

function FunctionDeclarationArgumentSpacingSniff::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.

Return value

void

Overrides Sniff::process

File

vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/Functions/FunctionDeclarationArgumentSpacingSniff.php, line 66

Class

FunctionDeclarationArgumentSpacingSniff

Namespace

PHP_CodeSniffer\Standards\Squiz\Sniffs\Functions

Code

public function process(File $phpcsFile, $stackPtr) {
    $tokens = $phpcsFile->getTokens();
    if (isset($tokens[$stackPtr]['parenthesis_opener']) === false || isset($tokens[$stackPtr]['parenthesis_closer']) === false || $tokens[$stackPtr]['parenthesis_opener'] === null || $tokens[$stackPtr]['parenthesis_closer'] === null) {
        return;
    }
    $this->equalsSpacing = (int) $this->equalsSpacing;
    $this->requiredSpacesAfterOpen = (int) $this->requiredSpacesAfterOpen;
    $this->requiredSpacesBeforeClose = (int) $this->requiredSpacesBeforeClose;
    $this->processBracket($phpcsFile, $tokens[$stackPtr]['parenthesis_opener']);
    if ($tokens[$stackPtr]['code'] === T_CLOSURE) {
        $use = $phpcsFile->findNext(T_USE, $tokens[$stackPtr]['parenthesis_closer'] + 1, $tokens[$stackPtr]['scope_opener']);
        if ($use !== false) {
            $openBracket = $phpcsFile->findNext(T_OPEN_PARENTHESIS, $use + 1, null);
            $this->processBracket($phpcsFile, $openBracket);
        }
    }
}

API Navigation

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