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

Breadcrumb

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

function DisallowLongArraySyntaxSniff::process

Same name in this branch
  1. 11.1.x vendor/squizlabs/php_codesniffer/src/Standards/Generic/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php \PHP_CodeSniffer\Standards\Generic\Sniffs\Arrays\DisallowLongArraySyntaxSniff::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|int

Overrides DisallowLongArraySyntaxSniff::process

File

vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Arrays/DisallowLongArraySyntaxSniff.php, line 36

Class

DisallowLongArraySyntaxSniff
Bans the use of the PHP long array syntax in Drupal 8.

Namespace

Drupal\Sniffs\Arrays

Code

public function process(File $phpcsFile, $stackPtr) {
    $drupalVersion = Project::getCoreVersion($phpcsFile);
    if ($drupalVersion < 8) {
        // No need to check this file again, mark it as done.
        return $phpcsFile->numTokens + 1;
    }
    parent::process($phpcsFile, $stackPtr);
}

API Navigation

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