IncludeSystemSniff
extends AbstractScopeSniff
in package
Table of Contents
- $ignore : array<string|int, string>
- A list of classes that don't need to be included.
- $listenOutside : bool
- True if this test should fire on tokens outside of the scope.
- $scopeTokens : string
- The type of scope opener tokens that this test wishes to listen to.
- $tokens : array<string|int, mixed>
- The token types that this test wishes to listen to within the scope.
- __construct() : mixed
- Constructs an AbstractScopeSniff.
- process() : void|int
- Processes the tokens that this test is listening for.
- register() : array<string|int, int>
- The method that is called to register the tokens this test wishes to listen to.
- getIncludedClassFromToken() : string
- Determines the included class name from given token.
- processTokenOutsideScope() : void
- Processes a token within the scope that this test is listening to.
- processTokenWithinScope() : void
- Processes the function tokens within the class.
Properties
$ignore
A list of classes that don't need to be included.
private
array<string|int, string>
$ignore
= ['self' => true, 'static' => true, 'parent' => true, 'channels' => true, 'basesystem' => true, 'dal' => true, 'init' => true, 'pdo' => true, 'util' => true, 'ziparchive' => true, 'phpunit_framework_assert' => true, 'abstractmysourceunittest' => true, 'abstractdatacleanunittest' => true, 'exception' => true, 'abstractwidgetwidgettype' => true, 'domdocument' => true]
$listenOutside
True if this test should fire on tokens outside of the scope.
private
bool
$listenOutside
= false
$scopeTokens
The type of scope opener tokens that this test wishes to listen to.
private
string
$scopeTokens
= []
$tokens
The token types that this test wishes to listen to within the scope.
private
array<string|int, mixed>
$tokens
= []
Methods
__construct()
Constructs an AbstractScopeSniff.
public
__construct() : mixed
Return values
mixed —process()
Processes the tokens that this test is listening for.
public
final process(File $phpcsFile, int $stackPtr) : void|int
Parameters
- $phpcsFile : File
-
The file where this token was found.
- $stackPtr : int
-
The position in the stack where this token was found.
Tags
Return values
void|int —Optionally returns a stack pointer. The sniff will not be called again on the current file until the returned stack pointer is reached. Return ($phpcsFile->numTokens + 1) to skip the rest of the file.
register()
The method that is called to register the tokens this test wishes to listen to.
public
final register() : array<string|int, int>
DO NOT OVERRIDE THIS METHOD. Use the constructor of this class to register for the desired tokens and scope.
Tags
Return values
array<string|int, int> —getIncludedClassFromToken()
Determines the included class name from given token.
protected
getIncludedClassFromToken(File $phpcsFile, array<string|int, mixed> $tokens, int $stackPtr) : string
Parameters
- $phpcsFile : File
-
The file where this token was found.
- $tokens : array<string|int, mixed>
-
The array of file tokens.
- $stackPtr : int
-
The position in the tokens array of the potentially included class.
Return values
string —processTokenOutsideScope()
Processes a token within the scope that this test is listening to.
protected
processTokenOutsideScope(File $phpcsFile, int $stackPtr) : void
Parameters
- $phpcsFile : File
-
The file where the token was found.
- $stackPtr : int
-
The position in the stack where this token was found.
Return values
void —processTokenWithinScope()
Processes the function tokens within the class.
protected
processTokenWithinScope(File $phpcsFile, int $stackPtr, int $currScope) : void
Parameters
- $phpcsFile : File
-
The file where this token was found.
- $stackPtr : int
-
The position where the token was found.
- $currScope : int
-
The current scope opener token.