DisallowUseFunctionSniff
in package
implements
Sniff
FinalYes
Disallow function import `use` statements.
Related sniffs:
Universal.UseStatements.DisallowUseClassUniversal.UseStatements.DisallowUseConst
Tags
Table of Contents
Interfaces
Constants
- METRIC_NAME_ALIAS = 'Use import statement for functions'
- Name of the "Use import with/without alias" metric.
- METRIC_NAME_SRC = 'Use import statement source for functions'
- Name of the "Use import source" metric.
Properties
- $currentFile : string
- Keep track of which file is being scanned.
- $currentNamespace : string
- Keep track of the current namespace.
Methods
- process() : void
- Processes this test, when one of its tokens is encountered.
- register() : array<string|int, int|string>
- Returns an array of tokens this test wants to listen for.
Constants
METRIC_NAME_ALIAS
Name of the "Use import with/without alias" metric.
public
string
METRIC_NAME_ALIAS
= 'Use import statement for functions'
Tags
METRIC_NAME_SRC
Name of the "Use import source" metric.
public
string
METRIC_NAME_SRC
= 'Use import statement source for functions'
Tags
Properties
$currentFile
Keep track of which file is being scanned.
private
string
$currentFile
= ''
Tags
$currentNamespace
Keep track of the current namespace.
private
string
$currentNamespace
= ''
Tags
Methods
process()
Processes this test, when one of its tokens is encountered.
public
process(File $phpcsFile, int $stackPtr) : void
Parameters
- $phpcsFile : File
-
The file being scanned.
- $stackPtr : int
-
The position of the current token in the stack passed in $tokens.
Tags
register()
Returns an array of tokens this test wants to listen for.
public
register() : array<string|int, int|string>