EnqueuedResourcesSniff
extends Sniff
in package
Makes sure scripts and styles are enqueued and not explicitly echo'd.
Tags
Table of Contents
Properties
- $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.
- find_token_in_multiline_string() : int
- Find the exact token on which the error should be reported for multi-line strings.
Properties
$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>find_token_in_multiline_string()
Find the exact token on which the error should be reported for multi-line strings.
private
find_token_in_multiline_string(int $stackPtr, string $content, int $match_offset) : int
Parameters
- $stackPtr : int
-
The position of the current token in the stack.
- $content : string
-
The complete, potentially multi-line, text string.
- $match_offset : int
-
The offset within the content at which the match was found.
Return values
int —The stack pointer to the token containing the start of the match.