Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. DiscouragedFunctionsSniff.php

class DiscouragedFunctionsSniff

Same name in this branch
  1. 11.1.x vendor/drupal/coder/coder_sniffer/Drupal/Sniffs/Functions/DiscouragedFunctionsSniff.php \Drupal\Sniffs\Functions\DiscouragedFunctionsSniff

Hierarchy

  • class \PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff implements \PHP_CodeSniffer\Sniffs\Sniff
    • class \PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP\DiscouragedFunctionsSniff extends \PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff

Expanded class hierarchy of DiscouragedFunctionsSniff

File

vendor/squizlabs/php_codesniffer/src/Standards/Squiz/Sniffs/PHP/DiscouragedFunctionsSniff.php, line 14

Namespace

PHP_CodeSniffer\Standards\Squiz\Sniffs\PHP
View source
class DiscouragedFunctionsSniff extends GenericForbiddenFunctionsSniff {
    
    /**
     * A list of forbidden functions with their alternatives.
     *
     * The value is NULL if no alternative exists. IE, the
     * function should just not be used.
     *
     * @var array<string, string|null>
     */
    public $forbiddenFunctions = [
        'error_log' => null,
        'print_r' => null,
        'var_dump' => null,
    ];
    
    /**
     * If true, an error will be thrown; otherwise a warning.
     *
     * @var boolean
     */
    public $error = false;

}

Members

Title Sort descending Modifiers Object type Summary Overriden Title Overrides
DiscouragedFunctionsSniff::$error public property If true, an error will be thrown; otherwise a warning. Overrides ForbiddenFunctionsSniff::$error
DiscouragedFunctionsSniff::$forbiddenFunctions public property A list of forbidden functions with their alternatives. Overrides ForbiddenFunctionsSniff::$forbiddenFunctions
ForbiddenFunctionsSniff::$forbiddenFunctionNames protected property A cache of forbidden function names, for faster lookups.
ForbiddenFunctionsSniff::$patternMatch protected property If true, forbidden functions will be considered regular expressions.
ForbiddenFunctionsSniff::addError protected function Generates the error or warning for this sniff. 1
ForbiddenFunctionsSniff::process public function Processes this test, when one of its tokens is encountered. Overrides Sniff::process
ForbiddenFunctionsSniff::register public function Returns an array of tokens this test wants to listen for. Overrides Sniff::register
RSS feed
Powered by Drupal