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

Breadcrumb

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

function DisallowSuperGlobalVariableSniff::process

* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint *

Parameters

int $variablePointer:

Overrides Sniff::process

File

vendor/slevomat/coding-standard/SlevomatCodingStandard/Sniffs/Variables/DisallowSuperGlobalVariableSniff.php, line 41

Class

DisallowSuperGlobalVariableSniff

Namespace

SlevomatCodingStandard\Sniffs\Variables

Code

public function process(File $phpcsFile, $variablePointer) : void {
    $tokens = $phpcsFile->getTokens();
    if (!in_array($tokens[$variablePointer]['content'], self::SUPER_GLOBALS, true)) {
        return;
    }
    $phpcsFile->addError('Use of super global variable is disallowed.', $variablePointer, self::CODE_DISALLOWED_SUPER_GLOBAL_VARIABLE);
}
RSS feed
Powered by Drupal