false, ); /** * Returns an array of tokens this test wants to listen for. * * @return array */ public function register() { return array( \T_VARIABLE, ); } /** * Process the token and handle the deprecation notice. * * @param int $stackPtr The position of the current token in the stack. * * @return void */ public function process_token( $stackPtr ) { if ( false === $this->thrown['DeprecatedSniff'] ) { $this->thrown['DeprecatedSniff'] = $this->phpcsFile->addWarning( 'The "WordPress.VIP.SessionVariableUsage" sniff has been deprecated. Please update your custom ruleset.', 0, 'DeprecatedSniff' ); } if ( '$_SESSION' === $this->tokens[ $stackPtr ]['content'] ) { $this->phpcsFile->addError( 'Usage of $_SESSION variable is prohibited.', $stackPtr, 'SessionVarsProhibited' ); } } }