Initial Commit
This commit is contained in:
93
database/php/pear/PHP/CodeSniffer/Sniff.php
Normal file
93
database/php/pear/PHP/CodeSniffer/Sniff.php
Normal file
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
/**
|
||||
* Represents a PHP_CodeSniffer sniff for sniffing coding standards.
|
||||
*
|
||||
* PHP version 5
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CodeSniffer
|
||||
* @author Greg Sherwood <gsherwood@squiz.net>
|
||||
* @author Marc McIntyre <mmcintyre@squiz.net>
|
||||
* @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
|
||||
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
|
||||
* @link http://pear.php.net/package/PHP_CodeSniffer
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a PHP_CodeSniffer sniff for sniffing coding standards.
|
||||
*
|
||||
* A sniff registers what token types it wishes to listen for, then, when
|
||||
* PHP_CodeSniffer encounters that token, the sniff is invoked and passed
|
||||
* information about where the token was found in the stack, and the
|
||||
* PHP_CodeSniffer file in which the token was found.
|
||||
*
|
||||
* @category PHP
|
||||
* @package PHP_CodeSniffer
|
||||
* @author Greg Sherwood <gsherwood@squiz.net>
|
||||
* @author Marc McIntyre <mmcintyre@squiz.net>
|
||||
* @copyright 2006-2011 Squiz Pty Ltd (ABN 77 084 670 600)
|
||||
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
|
||||
* @version Release: 1.3.3
|
||||
* @link http://pear.php.net/package/PHP_CodeSniffer
|
||||
*/
|
||||
interface PHP_CodeSniffer_Sniff
|
||||
{
|
||||
|
||||
|
||||
/**
|
||||
* Registers the tokens that this sniff wants to listen for.
|
||||
*
|
||||
* An example return value for a sniff that wants to listen for whitespace
|
||||
* and any comments would be:
|
||||
*
|
||||
* <code>
|
||||
* return array(
|
||||
* T_WHITESPACE,
|
||||
* T_DOC_COMMENT,
|
||||
* T_COMMENT,
|
||||
* );
|
||||
* </code>
|
||||
*
|
||||
* @return array(int)
|
||||
* @see Tokens.php
|
||||
*/
|
||||
public function register();
|
||||
|
||||
|
||||
/**
|
||||
* Called when one of the token types that this sniff is listening for
|
||||
* is found.
|
||||
*
|
||||
* The stackPtr variable indicates where in the stack the token was found.
|
||||
* A sniff can acquire information this token, along with all the other
|
||||
* tokens within the stack by first acquiring the token stack:
|
||||
*
|
||||
* <code>
|
||||
* $tokens = $phpcsFile->getTokens();
|
||||
* echo 'Encountered a '.$tokens[$stackPtr]['type'].' token';
|
||||
* echo 'token information: ';
|
||||
* print_r($tokens[$stackPtr]);
|
||||
* </code>
|
||||
*
|
||||
* If the sniff discovers an anomilty in the code, they can raise an error
|
||||
* by calling addError() on the PHP_CodeSniffer_File object, specifying an error
|
||||
* message and the position of the offending token:
|
||||
*
|
||||
* <code>
|
||||
* $phpcsFile->addError('Encountered an error', $stackPtr);
|
||||
* </code>
|
||||
*
|
||||
* @param PHP_CodeSniffer_File $phpcsFile The PHP_CodeSniffer file where the
|
||||
* token was found.
|
||||
* @param int $stackPtr The position in the PHP_CodeSniffer
|
||||
* file's token stack where the token
|
||||
* was found.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr);
|
||||
|
||||
|
||||
}//end interface
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user