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