false, 'FoundPropertyForDeprecatedSniff' => false, ); /** * Groups of functions to restrict. * * Example: groups => array( * 'lambda' => array( * 'type' => 'error' | 'warning', * 'message' => 'Use anonymous functions instead please!', * 'functions' => array( 'file_get_contents', 'create_function' ), * ) * ) * * @return array */ public function getGroups() { return array( 'session' => array( 'type' => 'error', 'message' => 'The use of PHP session function %s() is prohibited.', 'functions' => array( 'session_abort', 'session_cache_expire', 'session_cache_limiter', 'session_commit', 'session_create_id', 'session_decode', 'session_destroy', 'session_encode', 'session_gc', 'session_get_cookie_params', 'session_id', 'session_is_registered', 'session_module_name', 'session_name', 'session_regenerate_id', 'session_register_shutdown', 'session_register', 'session_reset', 'session_save_path', 'session_set_cookie_params', 'session_set_save_handler', 'session_start', 'session_status', 'session_unregister', 'session_unset', 'session_write_close', ), ), ); } /** * Process the token and handle the deprecation notices. * * @since 1.0.0 Added to allow for throwing the deprecation notices. * * @param int $stackPtr The position of the current token in the stack. * * @return void|int */ public function process_token( $stackPtr ) { if ( false === $this->thrown['DeprecatedSniff'] ) { $this->thrown['DeprecatedSniff'] = $this->phpcsFile->addWarning( 'The "WordPress.VIP.SessionFunctionsUsage" sniff has been deprecated. Please update your custom ruleset.', 0, 'DeprecatedSniff' ); } if ( ! empty( $this->exclude ) && false === $this->thrown['FoundPropertyForDeprecatedSniff'] ) { $this->thrown['FoundPropertyForDeprecatedSniff'] = $this->phpcsFile->addWarning( 'The "WordPress.VIP.SessionFunctionsUsage" sniff has been deprecated. Please update your custom ruleset.', 0, 'FoundPropertyForDeprecatedSniff' ); } return parent::process_token( $stackPtr ); } }