DirectDatabaseQuerySniff
extends Sniff
in package
Flag Database direct queries.
Tags
Table of Contents
Properties
- $customCacheDeleteFunctions : array<string|int, string>
- List of custom cache delete functions.
- $customCacheGetFunctions : array<string|int, string>
- List of custom cache get functions.
- $customCacheSetFunctions : array<string|int, string>
- List of custom cache set functions.
- $addedCustomFunctions : array<string|int, mixed>
- Cache of previously added custom functions.
- $cacheDeleteFunctions : array<string|int, mixed>
- A list of functions that delete data from the cache.
- $cacheGetFunctions : array<string|int, mixed>
- A list of functions that get data from the cache.
- $cacheSetFunctions : array<string|int, mixed>
- A list of functions that set data in the cache.
- $methods : array<string|int, array<string|int, mixed>>
- The lists of $wpdb methods.
- $phpcsFile : File
- The current file being sniffed.
- $tokens : array<string|int, mixed>
- The list of tokens in the current file being sniffed.
Methods
- process() : int|void
- Set sniff properties and hand off to child class for processing of the token.
- process_token() : int|void
- Processes this test, when one of its tokens is encountered.
- register() : array<string|int, mixed>
- Returns an array of tokens this test wants to listen for.
- mergeFunctionLists() : void
- Merge custom functions provided via a custom ruleset with the defaults, if we haven't already.
Properties
$customCacheDeleteFunctions
List of custom cache delete functions.
public
array<string|int, string>
$customCacheDeleteFunctions
= array()
Tags
$customCacheGetFunctions
List of custom cache get functions.
public
array<string|int, string>
$customCacheGetFunctions
= array()
Tags
$customCacheSetFunctions
List of custom cache set functions.
public
array<string|int, string>
$customCacheSetFunctions
= array()
Tags
$addedCustomFunctions
Cache of previously added custom functions.
protected
array<string|int, mixed>
$addedCustomFunctions
= array('cacheget' => array(), 'cacheset' => array(), 'cachedelete' => array())
Prevents having to do the same merges over and over again.
Tags
$cacheDeleteFunctions
A list of functions that delete data from the cache.
protected
array<string|int, mixed>
$cacheDeleteFunctions
= array('wp_cache_delete' => true, 'clean_attachment_cache' => true, 'clean_blog_cache' => true, 'clean_bookmark_cache' => true, 'clean_category_cache' => true, 'clean_comment_cache' => true, 'clean_network_cache' => true, 'clean_object_term_cache' => true, 'clean_page_cache' => true, 'clean_post_cache' => true, 'clean_term_cache' => true, 'clean_user_cache' => true)
Tags
$cacheGetFunctions
A list of functions that get data from the cache.
protected
array<string|int, mixed>
$cacheGetFunctions
= array('wp_cache_get' => true)
Tags
$cacheSetFunctions
A list of functions that set data in the cache.
protected
array<string|int, mixed>
$cacheSetFunctions
= array('wp_cache_set' => true, 'wp_cache_add' => true)
Tags
$methods
The lists of $wpdb methods.
protected
array<string|int, array<string|int, mixed>>
$methods
= array('cachable' => array('delete' => true, 'get_var' => true, 'get_col' => true, 'get_row' => true, 'get_results' => true, 'query' => true, 'replace' => true, 'update' => true), 'noncachable' => array('insert' => true))
Tags
$phpcsFile
The current file being sniffed.
protected
File
$phpcsFile
Tags
$tokens
The list of tokens in the current file being sniffed.
protected
array<string|int, mixed>
$tokens
Tags
Methods
process()
Set sniff properties and hand off to child class for processing of the token.
public
process(File $phpcsFile, int $stackPtr) : int|void
Parameters
- $phpcsFile : File
-
The file being scanned.
- $stackPtr : int
-
The position of the current token in the stack passed in $tokens.
Tags
Return values
int|void —Integer stack pointer to skip forward or void to continue normal file processing.
process_token()
Processes this test, when one of its tokens is encountered.
public
process_token(int $stackPtr) : int|void
Parameters
- $stackPtr : int
-
The position of the current token in the stack.
Return values
int|void —Integer stack pointer to skip forward or void to continue normal file processing.
register()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, mixed>
Return values
array<string|int, mixed>mergeFunctionLists()
Merge custom functions provided via a custom ruleset with the defaults, if we haven't already.
protected
mergeFunctionLists() : void