function DisallowLongArraySyntaxSniff::process
Same name in this branch
- 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\ArraysCode
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);
}