protected function processScopeClose(
        PHP_CodeSniffer_File
        $phpcsFile,
        $stackPtr
    ) {
        $scopeInfo = $this->getScopeInfo($stackPtr, false);
        if (is_null($scopeInfo)) {
            return;
        }
        foreach ($scopeInfo->variables as $varInfo) {
            if ($varInfo->ignoreUnused || isset($varInfo->firstRead)) {
                continue;
            }
            if ($this->allowUnusedFunctionParameters && $varInfo->scopeType == 'param') {
                continue;
            }
            if ($varInfo->passByReference && isset($varInfo->firstInitialized)) {
                // If we're pass-by-reference then it's a common pattern to
                // use the variable to return data to the caller, so any
                // assignment also counts as "variable use" for the purposes
                // of "unused variable" warnings.
                continue;
            }
            if (isset($varInfo->firstDeclared)) {
                $phpcsFile->addWarning(
                    "Unused %s %s.",
                    $varInfo->firstDeclared,
                    'UnusedVariable',
                    array(
                        VariableInfo::$scopeTypeDescriptions[$varInfo->scopeType],
                        "\${$varInfo->name}",
                    )
                );
            }
            if (isset($varInfo->firstInitialized)) {
                $phpcsFile->addWarning(
                    "Unused %s %s.",
                    $varInfo->firstInitialized,
                    'UnusedVariable',
                    array(
                        VariableInfo::$scopeTypeDescriptions[$varInfo->scopeType],
                        "\${$varInfo->name}",
                    )
                );
            }
        }
    }
protected function processScopeClose(
        PHP_CodeSniffer_File
        $phpcsFile,
        $stackPtr
    ) {
        $scopeInfo = $this->getScopeInfo($stackPtr, false);
        if (is_null($scopeInfo)) {
            return;
        }
        foreach ($scopeInfo->variables as $varInfo) {
            if ($varInfo->ignoreUnused || isset($varInfo->firstRead)) {
                continue;
            }
            if ($this->allowUnusedFunctionParameters && $varInfo->scopeType == 'param') {
                continue;
            }
            if ($varInfo->passByReference && isset($varInfo->firstInitialized)) {
                // If we're pass-by-reference then it's a common pattern to
                // use the variable to return data to the caller, so any
                // assignment also counts as "variable use" for the purposes
                // of "unused variable" warnings.
                continue;
            }
            if (isset($varInfo->firstDeclared)) {
                $phpcsFile->addWarning(
                    "Unused %s %s.",
                    $varInfo->firstDeclared,
                    'UnusedVariable',
                    array(
                        VariableInfo::$scopeTypeDescriptions[$varInfo->scopeType],
                        "\${$varInfo->name}",
                    )
                );
            }
            if (isset($varInfo->firstInitialized)) {
                $phpcsFile->addWarning(
                    "Unused %s %s.",
                    $varInfo->firstInitialized,
                    'UnusedVariable',
                    array(
                        VariableInfo::$scopeTypeDescriptions[$varInfo->scopeType],
                        "\${$varInfo->name}",
                    )
                );
            }
        }
    }
protected function processScopeClose ( PHP_CodeSniffer_File $ phpcsFile , $ stackPtr ) { $ scopeInfo = $ this -> getScopeInfo ( $ stackPtr , false ) ; if ( is_null ( $ scopeInfo ) ) { return ; } foreach ( $ scopeInfo -> variables as $ varInfo ) { if ( $ varInfo -> ignoreUnused || isset ( $ varInfo -> firstRead ) ) { continue ; } if ( $ this -> allowUnusedFunctionParameters && $ varInfo -> scopeType == 'param' ) { continue ; } if ( $ varInfo -> passByReference && isset ( $ varInfo -> firstInitialized ) ) { // If we're pass-by-reference then it's a common pattern to // use the variable to return data to the caller, so any // assignment also counts as "variable use" for the purposes // of "unused variable" warnings. continue ; } if ( isset ( $ varInfo -> firstDeclared ) ) { $ phpcsFile -> addWarning ( "Unused %s %s." , $ varInfo -> firstDeclared , 'UnusedVariable' , array ( VariableInfo :: $ scopeTypeDescriptions [ $ varInfo -> scopeType ] , "\${$varInfo->name}" , ) ) ; } if ( isset ( $ varInfo -> firstInitialized ) ) { $ phpcsFile -> addWarning ( "Unused %s %s." , $ varInfo -> firstInitialized , 'UnusedVariable' , array ( VariableInfo :: $ scopeTypeDescriptions [ $ varInfo -> scopeType ] , "\${$varInfo->name}" , ) ) ; } } }
Called to process the end of a scope.

Note that although triggered by the closing curly brace of the scope, $stackPtr is
the scope conditional, not the closing curly brace.

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

@return void
Called to process the end of a scope .