public function process(File $phpcsFile, $stackPtr)
    {
        $tokens  = $phpcsFile->getTokens();
        $varName = ltrim($tokens[$stackPtr]['content'], '$');

        if (!in_array($varName, $this->allowedNames)
            && preg_match('/^_/', $varName)
        ) {
            $phpcsFile->addWarning(
                'Variable names may not start with an underscore',
                $stackPtr,
                'IllegalVariableNameUnderscore'
            );
        }
    }
public function process(File $phpcsFile, $stackPtr)
    {
        $tokens  = $phpcsFile->getTokens();
        $varName = ltrim($tokens[$stackPtr]['content'], '$');

        if (!in_array($varName, $this->allowedNames)
            && preg_match('/^_/', $varName)
        ) {
            $phpcsFile->addWarning(
                'Variable names may not start with an underscore',
                $stackPtr,
                'IllegalVariableNameUnderscore'
            );
        }
    }
public function process ( File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ varName = ltrim ( $ tokens [ $ stackPtr ] [ 'content' ] , '$' ) ; if ( ! in_array ( $ varName , $ this -> allowedNames ) && preg_match ( '/^_/' , $ varName ) ) { $ phpcsFile -> addWarning ( 'Variable names may not start with an underscore' , $ stackPtr , 'IllegalVariableNameUnderscore' ) ; } }
Check variable names to make sure no underscores are used.

@param File $phpcsFile
@param int  $stackPtr

@return void
Check variable names to make sure no underscores are used .