West/Sniffs/PHP/NoConstSniff.php
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $error   = 'Use of constant "%s" is forbidden';
        $nextVar = $tokens[$phpcsFile->findNext([T_STRING], $stackPtr)];
        $varName = $nextVar['content'];
        $data    = [$varName];

        $phpcsFile->addError($error, $stackPtr, 'NotAllowed', $data);
    }
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens = $phpcsFile->getTokens();

        $error   = 'Use of constant "%s" is forbidden';
        $nextVar = $tokens[$phpcsFile->findNext([T_STRING], $stackPtr)];
        $varName = $nextVar['content'];
        $data    = [$varName];

        $phpcsFile->addError($error, $stackPtr, 'NotAllowed', $data);
    }
public function process ( File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ error = 'Use of constant "%s" is forbidden' ; $ nextVar = $ tokens [ $ phpcsFile -> findNext ( [ T_STRING ] , $ stackPtr ) ] ; $ varName = $ nextVar [ 'content' ] ; $ data = [ $ varName ] ; $ phpcsFile -> addError ( $ error , $ stackPtr , 'NotAllowed' , $ data ) ; }
{@inheritdoc}
{