12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- <?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 Squiz Pty Ltd (ABN 77 084 670 600)
- * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version CVS: $Id: Sniff.php 247324 2007-11-30 01:18:41Z squiz $
- * @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 Squiz Pty Ltd (ABN 77 084 670 600)
- * @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
- * @version Release: 1.3.0RC1
- * @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
- ?>
|