MySource_Sniffs_Channels_IncludeSystemSniff
extends PHP_CodeSniffer_Standards_AbstractScopeSniff
in package
Ensures that systems, asset types and libs are included before they are used.
Tags
Table of Contents
- $_ignore : array<string|int, mixed>|(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 a Squiz_Sniffs_Scope_MethodScopeSniff.
- process() : void
- 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, mixed>|(string)
$_ignore
= array('self' => rue, 'static' => rue, 'parent' => rue, 'channels' => rue, 'basesystem' => rue, 'dal' => rue, 'init' => rue, 'pdo' => rue, 'util' => rue, 'ziparchive' => rue, 'phpunit_framework_assert' => rue, 'abstractmysourceunittest' => rue, 'abstractdatacleanunittest' => rue, 'exception' => rue, 'abstractwidgetwidgettype' => rue, 'domdocument' => rue)
$_listenOutside
True if this test should fire on tokens outside of the scope.
private
bool
$_listenOutside
= alse
$_scopeTokens
The type of scope opener tokens that this test wishes to listen to.
private
string
$_scopeTokens
= array()
$_tokens
The token types that this test wishes to listen to within the scope.
private
array<string|int, mixed>
$_tokens
= array()
Methods
__construct()
Constructs a Squiz_Sniffs_Scope_MethodScopeSniff.
public
__construct() : mixed
Return values
mixed —process()
Processes the tokens that this test is listening for.
public
final process(PHP_CodeSniffer_File $phpcsFile, int $stackPtr) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file where this token was found.
- $stackPtr : int
-
The position in the stack where this token was found.
Tags
Return values
void —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(PHP_CodeSniffer_File $phpcsFile, array<string|int, mixed> $tokens, int $stackPtr) : string
Parameters
- $phpcsFile : PHP_CodeSniffer_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(PHP_CodeSniffer_File $phpcsFile, int $stackPtr) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_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(PHP_CodeSniffer_File $phpcsFile, int $stackPtr, int $currScope) : void
Parameters
- $phpcsFile : PHP_CodeSniffer_File
-
The file where this token was found.
- $stackPtr : int
-
The position where the token was found.
- $currScope : int
-
The current scope opener token.