You are here

class DiscouragedFunctionsSniff in Coder 8.2

Same name and namespace in other branches
  1. 8.3 coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php \Drupal\Sniffs\Functions\DiscouragedFunctionsSniff
  2. 8.3.x coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php \Drupal\Sniffs\Functions\DiscouragedFunctionsSniff

Discourage the use of debug functions.

@category PHP @package PHP_CodeSniffer @link http://pear.php.net/package/PHP_CodeSniffer

Hierarchy

  • class \Drupal\Sniffs\Functions\DiscouragedFunctionsSniff extends \PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff

Expanded class hierarchy of DiscouragedFunctionsSniff

File

coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php, line 21

Namespace

Drupal\Sniffs\Functions
View source
class DiscouragedFunctionsSniff extends ForbiddenFunctionsSniff {

  /**
   * A list of forbidden functions with their alternatives.
   *
   * The value is NULL if no alternative exists, i.e., the function should
   * just not be used.
   *
   * @var array(string => string|null)
   */
  public $forbiddenFunctions = array(
    // Devel module debugging functions.
    'dargs' => null,
    'dcp' => null,
    'dd' => null,
    'dfb' => null,
    'dfbt' => null,
    'dpm' => null,
    'dpq' => null,
    'dpr' => null,
    'dprint_r' => null,
    'drupal_debug' => null,
    'dsm' => null,
    'dvm' => null,
    'dvr' => null,
    'kdevel_print_object' => null,
    'kpr' => null,
    'kprint_r' => null,
    'sdpm' => null,
    // Functions which are not available on all
    // PHP builds.
    'fnmatch' => null,
    // Functions which are a security risk.
    'eval' => null,
  );

  /**
   * If true, an error will be thrown; otherwise a warning.
   *
   * @var bool
   */
  public $error = false;

}

Members

Namesort descending Modifiers Type Description Overrides
DiscouragedFunctionsSniff::$error public property If true, an error will be thrown; otherwise a warning.
DiscouragedFunctionsSniff::$forbiddenFunctions public property A list of forbidden functions with their alternatives.