Got/Sniffs/NamingConventions/ValidVariableNameSniff.php
protected function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens      = $phpcsFile->getTokens();
        $varName     = ltrim($tokens[$stackPtr]['content'], '$');
        $memberProps = $phpcsFile->getMemberProperties($stackPtr);
        $public      = ($memberProps['scope'] === 'public');

        if (substr($varName, 0, 1) === '_') {
            $error = 'Member variable "%s" must not contain a leading underscore';
            $data  = array($varName);
            $phpcsFile->addError($error, $stackPtr, 'PublicHasUnderscore', $data);
            return;
        }

        if (!preg_match('~^[a-z]+$~', $varName)) {
            if (PHP_CodeSniffer::isCamelCaps($varName, false, true, true) === false) {
                $error = 'Variable "%s" is not in valid camel caps format';
                $data  = array($varName);
                $phpcsFile->addError($error, $stackPtr, 'MemberVarNotCamelCaps', $data);
            } elseif (preg_match('|\d|', $varName)) {
                $warning = 'Variable "%s" contains numbers but this is discouraged';
                $data    = array($varName);
                $phpcsFile->addWarning($warning, $stackPtr, 'MemberVarContainsNumbers', $data);
            }
        }

    }
protected function processMemberVar(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
    {
        $tokens      = $phpcsFile->getTokens();
        $varName     = ltrim($tokens[$stackPtr]['content'], '$');
        $memberProps = $phpcsFile->getMemberProperties($stackPtr);
        $public      = ($memberProps['scope'] === 'public');

        if (substr($varName, 0, 1) === '_') {
            $error = 'Member variable "%s" must not contain a leading underscore';
            $data  = array($varName);
            $phpcsFile->addError($error, $stackPtr, 'PublicHasUnderscore', $data);
            return;
        }

        if (!preg_match('~^[a-z]+$~', $varName)) {
            if (PHP_CodeSniffer::isCamelCaps($varName, false, true, true) === false) {
                $error = 'Variable "%s" is not in valid camel caps format';
                $data  = array($varName);
                $phpcsFile->addError($error, $stackPtr, 'MemberVarNotCamelCaps', $data);
            } elseif (preg_match('|\d|', $varName)) {
                $warning = 'Variable "%s" contains numbers but this is discouraged';
                $data    = array($varName);
                $phpcsFile->addWarning($warning, $stackPtr, 'MemberVarContainsNumbers', $data);
            }
        }

    }
Processes class member variables.

@param PHP_CodeSniffer_File $phpcsFile The file being scanned.
@param int                  $stackPtr  The position of the current token in the
stack passed in $tokens.

@return void