BlueSpice MediaWiki master
 All Classes Namespaces Files Functions Variables Groups Pages
PHP_CodeSniffer\Sniffs\AbstractScopeSniff Class Reference
Inheritance diagram for PHP_CodeSniffer\Sniffs\AbstractScopeSniff:
Collaboration diagram for PHP_CodeSniffer\Sniffs\AbstractScopeSniff:

Public Member Functions

 __construct (array $scopeTokens, array $tokens, $listenOutside=false)
 
 register ()
 
 process (File $phpcsFile, $stackPtr)
 

Protected Member Functions

 processTokenWithinScope (File $phpcsFile, $stackPtr, $currScope)
 
 processTokenOutsideScope (File $phpcsFile, $stackPtr)
 

Constructor & Destructor Documentation

PHP_CodeSniffer\Sniffs\AbstractScopeSniff::__construct ( array  $scopeTokens,
array  $tokens,
  $listenOutside = false 
)

Constructs a new AbstractScopeTest.

Parameters
array$scopeTokensThe type of scope the test wishes to listen to.
array$tokensThe tokens that the test wishes to listen to within the scope.
boolean$listenOutsideIf true this test will also alert the extending class when a token is found outside the scope, by calling the processTokenOutsideScope method.
See Also
PHP_CodeSniffer.getValidScopeTokeners()
Exceptions
\PHP_CodeSniffer\Exceptions\RuntimeExceptionIf the specified tokens array is empty.

Member Function Documentation

PHP_CodeSniffer\Sniffs\AbstractScopeSniff::process ( File  $phpcsFile,
  $stackPtr 
)
final

Processes the tokens that this test is listening for.

Parameters
\PHP_CodeSniffer\Files\File$phpcsFileThe file where this token was found.
int$stackPtrThe position in the stack where this token was found.
Returns
void
See Also
processTokenWithinScope()

Implements PHP_CodeSniffer\Sniffs\Sniff.

PHP_CodeSniffer\Sniffs\AbstractScopeSniff::processTokenOutsideScope ( File  $phpcsFile,
  $stackPtr 
)
abstractprotected

Processes a token that is found outside the scope that this test is listening to.

Parameters
\PHP_CodeSniffer\Files\File$phpcsFileThe file where this token was found.
int$stackPtrThe position in the stack where this token was found.
Returns
void
PHP_CodeSniffer\Sniffs\AbstractScopeSniff::processTokenWithinScope ( File  $phpcsFile,
  $stackPtr,
  $currScope 
)
abstractprotected

Processes a token that is found within the scope that this test is listening to.

Parameters
\PHP_CodeSniffer\Files\File$phpcsFileThe file where this token was found.
int$stackPtrThe position in the stack where this token was found.
int$currScopeThe position in the tokens array that opened the scope that this test is listening for.
Returns
void
PHP_CodeSniffer\Sniffs\AbstractScopeSniff::register ( )
final

The method that is called to register the tokens this test wishes to listen to.

DO NOT OVERRIDE THIS METHOD. Use the constructor of this class to register for the desired tokens and scope.

Returns
int[]
See Also
__constructor()

Implements PHP_CodeSniffer\Sniffs\Sniff.


The documentation for this class was generated from the following file: