1<?php 2/** 3 * Squiz_Sniffs_PHP_ForbiddenFunctionsSniff. 4 * 5 * PHP version 5 6 * 7 * @category PHP 8 * @package PHP_CodeSniffer 9 * @author Greg Sherwood <gsherwood@squiz.net> 10 * @author Marc McIntyre <mmcintyre@squiz.net> 11 * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) 12 * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence 13 * @link http://pear.php.net/package/PHP_CodeSniffer 14 */ 15 16if (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_ForbiddenFunctionsSniff. 22 * 23 * Discourages the use of alias functions that are kept in PHP for compatibility 24 * with older versions. Can be used to forbid the use of any function. 25 * 26 * @category PHP 27 * @package PHP_CodeSniffer 28 * @author Greg Sherwood <gsherwood@squiz.net> 29 * @author Marc McIntyre <mmcintyre@squiz.net> 30 * @copyright 2006-2014 Squiz Pty Ltd (ABN 77 084 670 600) 31 * @license https://github.com/squizlabs/PHP_CodeSniffer/blob/master/licence.txt BSD Licence 32 * @version Release: @package_version@ 33 * @link http://pear.php.net/package/PHP_CodeSniffer 34 */ 35class Squiz_Sniffs_PHP_ForbiddenFunctionsSniff extends Generic_Sniffs_PHP_ForbiddenFunctionsSniff 36{ 37 38 /** 39 * A list of forbidden functions with their alternatives. 40 * 41 * The value is NULL if no alternative exists. IE, the 42 * function should just not be used. 43 * 44 * @var array(string => string|null) 45 */ 46 public $forbiddenFunctions = array( 47 'sizeof' => 'count', 48 'delete' => 'unset', 49 'print' => 'echo', 50 'is_null' => null, 51 'create_function' => null, 52 ); 53 54}//end class 55