protected function processVariable(
        PHP_CodeSniffer_File $phpcsFile,
        $stackPtr
    ) {
        $tokens = $phpcsFile->getTokens();
        $token  = $tokens[$stackPtr];

        $varName = $this->normalizeVarName($token['content']);
        if (($currScope = $this->findVariableScope($phpcsFile, $stackPtr)) === false) {
            return;
        }

        //static $dump_token = false;
        //if ($varName == 'property') {
        //    $dump_token = true;
        //}
        //if ($dump_token) {
        //    echo "Found variable {$varName} on line {$token['line']} in scope {$currScope}.\n" . print_r($token, true);
        //    echo "Prev:\n" . print_r($tokens[$stackPtr - 1], true);
        //}

        // Determine if variable is being assigned or read.

        // Read methods that preempt assignment:
        //   Are we a $object->$property type symbolic reference?

        // Possible assignment methods:
        //   Is a mandatory function/closure parameter
        //   Is an optional function/closure parameter with non-null value
        //   Is closure use declaration of a variable defined within containing scope
        //   catch (...) block start
        //   $this within a class (but not within a closure).
        //   $GLOBALS, $_REQUEST, etc superglobals.
        //   $var part of class::$var static member
        //   Assignment via =
        //   Assignment via list (...) =
        //   Declares as a global
        //   Declares as a static
        //   Assignment via foreach (... as ...) { }
        //   Pass-by-reference to known pass-by-reference function

        // Are we a $object->$property type symbolic reference?
        if ($this->checkForSymbolicObjectProperty($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a function or closure parameter?
        if ($this->checkForFunctionPrototype($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a catch parameter?
        if ($this->checkForCatchBlock($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we $this within a class?
        if ($this->checkForThisWithinClass($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a $GLOBALS, $_REQUEST, etc superglobal?
        if ($this->checkForSuperGlobal($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // $var part of class::$var static member
        if ($this->checkForStaticMember($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Is the next non-whitespace an assignment?
        if ($this->checkForAssignment($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // OK, are we within a list (...) = construct?
        if ($this->checkForListAssignment($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a global declaration?
        if ($this->checkForGlobalDeclaration($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a static declaration?
        if ($this->checkForStaticDeclaration($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a foreach loopvar?
        if ($this->checkForForeachLoopVar($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we pass-by-reference to known pass-by-reference function?
        if ($this->checkForPassByReferenceFunctionCall($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // OK, we don't appear to be a write to the var, assume we're a read.
        $this->markVariableReadAndWarnIfUndefined($phpcsFile, $varName, $stackPtr, $currScope);
    }
protected function processVariable(
        PHP_CodeSniffer_File $phpcsFile,
        $stackPtr
    ) {
        $tokens = $phpcsFile->getTokens();
        $token  = $tokens[$stackPtr];

        $varName = $this->normalizeVarName($token['content']);
        if (($currScope = $this->findVariableScope($phpcsFile, $stackPtr)) === false) {
            return;
        }

        //static $dump_token = false;
        //if ($varName == 'property') {
        //    $dump_token = true;
        //}
        //if ($dump_token) {
        //    echo "Found variable {$varName} on line {$token['line']} in scope {$currScope}.\n" . print_r($token, true);
        //    echo "Prev:\n" . print_r($tokens[$stackPtr - 1], true);
        //}

        // Determine if variable is being assigned or read.

        // Read methods that preempt assignment:
        //   Are we a $object->$property type symbolic reference?

        // Possible assignment methods:
        //   Is a mandatory function/closure parameter
        //   Is an optional function/closure parameter with non-null value
        //   Is closure use declaration of a variable defined within containing scope
        //   catch (...) block start
        //   $this within a class (but not within a closure).
        //   $GLOBALS, $_REQUEST, etc superglobals.
        //   $var part of class::$var static member
        //   Assignment via =
        //   Assignment via list (...) =
        //   Declares as a global
        //   Declares as a static
        //   Assignment via foreach (... as ...) { }
        //   Pass-by-reference to known pass-by-reference function

        // Are we a $object->$property type symbolic reference?
        if ($this->checkForSymbolicObjectProperty($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a function or closure parameter?
        if ($this->checkForFunctionPrototype($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a catch parameter?
        if ($this->checkForCatchBlock($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we $this within a class?
        if ($this->checkForThisWithinClass($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a $GLOBALS, $_REQUEST, etc superglobal?
        if ($this->checkForSuperGlobal($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // $var part of class::$var static member
        if ($this->checkForStaticMember($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Is the next non-whitespace an assignment?
        if ($this->checkForAssignment($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // OK, are we within a list (...) = construct?
        if ($this->checkForListAssignment($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a global declaration?
        if ($this->checkForGlobalDeclaration($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a static declaration?
        if ($this->checkForStaticDeclaration($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we a foreach loopvar?
        if ($this->checkForForeachLoopVar($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // Are we pass-by-reference to known pass-by-reference function?
        if ($this->checkForPassByReferenceFunctionCall($phpcsFile, $stackPtr, $varName, $currScope)) {
            return;
        }

        // OK, we don't appear to be a write to the var, assume we're a read.
        $this->markVariableReadAndWarnIfUndefined($phpcsFile, $varName, $stackPtr, $currScope);
    }
protected function processVariable ( PHP_CodeSniffer_File $ phpcsFile , $ stackPtr ) { $ tokens = $ phpcsFile -> getTokens ( ) ; $ token = $ tokens [ $ stackPtr ] ; $ varName = $ this -> normalizeVarName ( $ token [ 'content' ] ) ; if ( ( $ currScope = $ this -> findVariableScope ( $ phpcsFile , $ stackPtr ) ) === false ) { return ; } //static $dump_token = false; //if ($varName == 'property') { //    $dump_token = true; //} //if ($dump_token) { //    echo "Found variable {$varName} on line {$token['line']} in scope {$currScope}.\n" . print_r($token, true); //    echo "Prev:\n" . print_r($tokens[$stackPtr - 1], true); //} // Determine if variable is being assigned or read. // Read methods that preempt assignment: //   Are we a $object->$property type symbolic reference? // Possible assignment methods: //   Is a mandatory function/closure parameter //   Is an optional function/closure parameter with non-null value //   Is closure use declaration of a variable defined within containing scope //   catch (...) block start //   $this within a class (but not within a closure). //   $GLOBALS, $_REQUEST, etc superglobals. //   $var part of class::$var static member //   Assignment via = //   Assignment via list (...) = //   Declares as a global //   Declares as a static //   Assignment via foreach (... as ...) { } //   Pass-by-reference to known pass-by-reference function // Are we a $object->$property type symbolic reference? if ( $ this -> checkForSymbolicObjectProperty ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // Are we a function or closure parameter? if ( $ this -> checkForFunctionPrototype ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // Are we a catch parameter? if ( $ this -> checkForCatchBlock ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // Are we $this within a class? if ( $ this -> checkForThisWithinClass ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // Are we a $GLOBALS, $_REQUEST, etc superglobal? if ( $ this -> checkForSuperGlobal ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // $var part of class::$var static member if ( $ this -> checkForStaticMember ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // Is the next non-whitespace an assignment? if ( $ this -> checkForAssignment ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // OK, are we within a list (...) = construct? if ( $ this -> checkForListAssignment ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // Are we a global declaration? if ( $ this -> checkForGlobalDeclaration ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // Are we a static declaration? if ( $ this -> checkForStaticDeclaration ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // Are we a foreach loopvar? if ( $ this -> checkForForeachLoopVar ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // Are we pass-by-reference to known pass-by-reference function? if ( $ this -> checkForPassByReferenceFunctionCall ( $ phpcsFile , $ stackPtr , $ varName , $ currScope ) ) { return ; } // OK, we don't appear to be a write to the var, assume we're a read. $ this -> markVariableReadAndWarnIfUndefined ( $ phpcsFile , $ varName , $ stackPtr , $ currScope ) ; }
Called to process normal member vars.

@param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where this
token was found.
@param int                  $stackPtr  The position where the token was found.

@return void
Called to process normal member vars .