Subversion-Projekte lars-tiefland.php_share

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
1 lars 1
<?php
2
/**
3
 * Squiz_Sniffs_NamingConventions_ValidFunctionNameSniff.
4
 *
5
 * PHP version 5
6
 *
7
 * @category  PHP
8
 * @package   PHP_CodeSniffer
9
 * @author    Greg Sherwood <gsherwood@squiz.net>
10
 * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
11
 * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
12
 * @version   CVS: $Id: ConstantCaseSniff.php 253115 2008-02-18 00:02:52Z squiz $
13
 * @link      http://pear.php.net/package/PHP_CodeSniffer
14
 */
15
 
16
if (class_exists('Generic_Sniffs_PHP_LowerCaseConstantSniff', true) === false) {
17
    $error = 'Class Generic_Sniffs_PHP_LowerCaseConstantSniff not found';
18
    throw new PHP_CodeSniffer_Exception($error);
19
}
20
 
21
if (class_exists('Generic_Sniffs_PHP_UpperCaseConstantSniff', true) === false) {
22
    $error = 'Class Generic_Sniffs_PHP_UpperCaseConstantSniff not found';
23
    throw new PHP_CodeSniffer_Exception($error);
24
}
25
 
26
/**
27
 * Squiz_Sniffs_NamingConventions_ConstantCaseSniff.
28
 *
29
 * Ensures TRUE, FALSE and NULL are uppercase for PHP and lowercase for JS.
30
 *
31
 * @category  PHP
32
 * @package   PHP_CodeSniffer
33
 * @author    Greg Sherwood <gsherwood@squiz.net>
34
 * @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
35
 * @license   http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
36
 * @version   Release: 1.2.1
37
 * @link      http://pear.php.net/package/PHP_CodeSniffer
38
 */
39
class Squiz_Sniffs_NamingConventions_ConstantCaseSniff extends Generic_Sniffs_PHP_LowerCaseConstantSniff
40
{
41
 
42
 
43
    /**
44
     * Processes this sniff, when one of its tokens is encountered.
45
     *
46
     * @param PHP_CodeSniffer_File $phpcsFile The file being scanned.
47
     * @param int                  $stackPtr  The position of the current token
48
     *                                        in the stack passed in $tokens.
49
     *
50
     * @return void
51
     */
52
    public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
53
    {
54
        if ($phpcsFile->tokenizerType === 'JS') {
55
            parent::process($phpcsFile, $stackPtr);
56
        } else {
57
            $sniff = new Generic_Sniffs_PHP_UpperCaseConstantSniff;
58
            $sniff->process($phpcsFile, $stackPtr);
59
        }
60
 
61
    }//end process()
62
 
63
 
64
}//end class
65
 
66
?>