WPDBTrait
Helper utilities for sniffs which examine WPDB method calls.
Tags
Table of Contents
Methods
- is_wpdb_method_call() : bool
- Checks whether this is a call to a $wpdb method that we want to sniff.
Methods
is_wpdb_method_call()
Checks whether this is a call to a $wpdb method that we want to sniff.
protected
final is_wpdb_method_call(File $phpcsFile, int $stackPtr, array<string|int, mixed> $target_methods) : bool
If available in the class using this trait, the $methodPtr, $i and $end properties are automatically set to correspond to the start and end of the method call. The $i property is also set if this is not a method call but rather the use of a $wpdb property.
Parameters
- $phpcsFile : File
-
The file being scanned.
- $stackPtr : int
-
The index of the $wpdb variable.
- $target_methods : array<string|int, mixed>
-
Array of methods. Key(s) should be method name in lowercase.
Tags
Return values
bool —Whether this is a $wpdb method call.