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}",
                    )
                );
            }
        }
    }