| 1 |
lars |
1 |
<?php
|
|
|
2 |
/**
|
|
|
3 |
* Squiz_Sniffs_PHP_DiscouragedFunctionsSniff.
|
|
|
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: DiscouragedFunctionsSniff.php 265110 2008-08-19 06:36:11Z squiz $
|
|
|
13 |
* @link http://pear.php.net/package/PHP_CodeSniffer
|
|
|
14 |
*/
|
|
|
15 |
|
|
|
16 |
if (class_exists('Generic_Sniffs_PHP_ForbiddenFunctionsSniff', true) === false) {
|
|
|
17 |
throw new PHP_CodeSniffer_Exception('Class Generic_Sniffs_PHP_ForbiddenFunctionsSniff not found');
|
|
|
18 |
}
|
|
|
19 |
|
|
|
20 |
/**
|
|
|
21 |
* Squiz_Sniffs_PHP_DiscouragedFunctionsSniff.
|
|
|
22 |
*
|
|
|
23 |
* Discourages the use of debug functions.
|
|
|
24 |
*
|
|
|
25 |
* @category PHP
|
|
|
26 |
* @package PHP_CodeSniffer
|
|
|
27 |
* @author Greg Sherwood <gsherwood@squiz.net>
|
|
|
28 |
* @copyright 2006 Squiz Pty Ltd (ABN 77 084 670 600)
|
|
|
29 |
* @license http://matrix.squiz.net/developer/tools/php_cs/licence BSD Licence
|
|
|
30 |
* @version Release: 1.2.1
|
|
|
31 |
* @link http://pear.php.net/package/PHP_CodeSniffer
|
|
|
32 |
*/
|
|
|
33 |
class Squiz_Sniffs_PHP_DiscouragedFunctionsSniff extends Generic_Sniffs_PHP_ForbiddenFunctionsSniff
|
|
|
34 |
{
|
|
|
35 |
|
|
|
36 |
/**
|
|
|
37 |
* A list of forbidden functions with their alternatives.
|
|
|
38 |
*
|
|
|
39 |
* The value is NULL if no alternative exists. IE, the
|
|
|
40 |
* function should just not be used.
|
|
|
41 |
*
|
|
|
42 |
* @var array(string => string|null)
|
|
|
43 |
*/
|
|
|
44 |
protected $forbiddenFunctions = array(
|
|
|
45 |
'error_log' => null,
|
|
|
46 |
'print_r' => null,
|
|
|
47 |
);
|
|
|
48 |
|
|
|
49 |
/**
|
|
|
50 |
* If true, an error will be thrown; otherwise a warning.
|
|
|
51 |
*
|
|
|
52 |
* @var bool
|
|
|
53 |
*/
|
|
|
54 |
protected $error = false;
|
|
|
55 |
|
|
|
56 |
}//end class
|
|
|
57 |
|
|
|
58 |
?>
|