annotate vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author |
Chris Cannam |
date |
Thu, 28 Feb 2019 13:21:36 +0000 |
parents |
4c8ae668cc8c |
children |
|
rev |
line source |
Chris@0
|
1 <?php
|
Chris@0
|
2 /**
|
Chris@17
|
3 * \Drupal\Sniffs\Functions\DiscouragedFunctionsSniff.
|
Chris@0
|
4 *
|
Chris@0
|
5 * @category PHP
|
Chris@0
|
6 * @package PHP_CodeSniffer
|
Chris@0
|
7 * @link http://pear.php.net/package/PHP_CodeSniffer
|
Chris@0
|
8 */
|
Chris@0
|
9
|
Chris@17
|
10 namespace Drupal\Sniffs\Functions;
|
Chris@17
|
11
|
Chris@17
|
12 use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
|
Chris@17
|
13
|
Chris@0
|
14 /**
|
Chris@0
|
15 * Discourage the use of debug functions.
|
Chris@0
|
16 *
|
Chris@0
|
17 * @category PHP
|
Chris@0
|
18 * @package PHP_CodeSniffer
|
Chris@0
|
19 * @link http://pear.php.net/package/PHP_CodeSniffer
|
Chris@0
|
20 */
|
Chris@17
|
21 class DiscouragedFunctionsSniff extends ForbiddenFunctionsSniff
|
Chris@0
|
22 {
|
Chris@0
|
23
|
Chris@0
|
24 /**
|
Chris@0
|
25 * A list of forbidden functions with their alternatives.
|
Chris@0
|
26 *
|
Chris@0
|
27 * The value is NULL if no alternative exists, i.e., the function should
|
Chris@0
|
28 * just not be used.
|
Chris@0
|
29 *
|
Chris@0
|
30 * @var array(string => string|null)
|
Chris@0
|
31 */
|
Chris@0
|
32 public $forbiddenFunctions = array(
|
Chris@0
|
33 // Devel module debugging functions.
|
Chris@0
|
34 'dargs' => null,
|
Chris@0
|
35 'dcp' => null,
|
Chris@0
|
36 'dd' => null,
|
Chris@0
|
37 'dfb' => null,
|
Chris@0
|
38 'dfbt' => null,
|
Chris@0
|
39 'dpm' => null,
|
Chris@0
|
40 'dpq' => null,
|
Chris@0
|
41 'dpr' => null,
|
Chris@0
|
42 'dprint_r' => null,
|
Chris@0
|
43 'drupal_debug' => null,
|
Chris@0
|
44 'dsm' => null,
|
Chris@0
|
45 'dvm' => null,
|
Chris@0
|
46 'dvr' => null,
|
Chris@0
|
47 'kdevel_print_object' => null,
|
Chris@0
|
48 'kpr' => null,
|
Chris@0
|
49 'kprint_r' => null,
|
Chris@0
|
50 'sdpm' => null,
|
Chris@0
|
51 // Functions which are not available on all
|
Chris@0
|
52 // PHP builds.
|
Chris@0
|
53 'fnmatch' => null,
|
Chris@0
|
54 // Functions which are a security risk.
|
Chris@0
|
55 'eval' => null,
|
Chris@0
|
56 );
|
Chris@0
|
57
|
Chris@0
|
58 /**
|
Chris@0
|
59 * If true, an error will be thrown; otherwise a warning.
|
Chris@0
|
60 *
|
Chris@0
|
61 * @var bool
|
Chris@0
|
62 */
|
Chris@0
|
63 public $error = false;
|
Chris@0
|
64
|
Chris@0
|
65 }//end class
|