Documentation

DisallowUseClassSniff
in package
implements Sniff

FinalYes

Disallow class/trait/interface/enum import `use` statements.

Related sniffs:

  • Universal.UseStatements.DisallowUseFunction
  • Universal.UseStatements.DisallowUseConst
Tags
since
1.0.0

Table of Contents

Interfaces

Sniff

Constants

METRIC_NAME_ALIAS  = 'Use import statement for class/interface/trait/enum'
Name of the "Use import with/without alias" metric.
METRIC_NAME_SRC  = 'Use import statement source for class/interface/trait/enum'
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 class/interface/trait/enum'
Tags
since
1.0.0

METRIC_NAME_SRC

Name of the "Use import source" metric.

public string METRIC_NAME_SRC = 'Use import statement source for class/interface/trait/enum'
Tags
since
1.0.0

Properties

$currentFile

Keep track of which file is being scanned.

private string $currentFile = ''
Tags
since
1.0.0

$currentNamespace

Keep track of the current namespace.

private string $currentNamespace = ''
Tags
since
1.0.0

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
since
1.0.0

register()

Returns an array of tokens this test wants to listen for.

public register() : array<string|int, int|string>
Tags
since
1.0.0
Return values
array<string|int, int|string>

        
On this page

Search results