original_string: protected function addError($phpcsFile, $stackPtr, $function, $pattern=null)
      {
          $data  = array($function);
          $error = 'The use of function %s() is ';
          if ($this->error === true) {
              $type   = 'Found';
              $error .= 'forbidden';
          } else {
              $type   = 'Discouraged';
              $error .= 'discouraged';
          }
  
          if ($pattern === null) {
              $pattern = $function;
          }
  
          if ($this->forbiddenFunctions[$pattern] !== null
              && $this->forbiddenFunctions[$pattern] !== 'null'
          ) {
              $type  .= 'WithAlternative';
              $data[] = $this->forbiddenFunctions[$pattern];
              $error .= '; use %s() instead';
          }
  
          if ($this->error === true) {
              $phpcsFile->addError($error, $stackPtr, $type, $data);
          } else {
              $phpcsFile->addWarning($error, $stackPtr, $type, $data);
          }
  
      }
code: protected function addError($phpcsFile, $stackPtr, $function, $pattern=null)
      {
          $data  = array($function);
          $error = 'The use of function %s() is ';
          if ($this->error === true) {
              $type   = 'Found';
              $error .= 'forbidden';
          } else {
              $type   = 'Discouraged';
              $error .= 'discouraged';
          }
  
          if ($pattern === null) {
              $pattern = $function;
          }
  
          if ($this->forbiddenFunctions[$pattern] !== null
              && $this->forbiddenFunctions[$pattern] !== 'null'
          ) {
              $type  .= 'WithAlternative';
              $data[] = $this->forbiddenFunctions[$pattern];
              $error .= '; use %s() instead';
          }
  
          if ($this->error === true) {
              $phpcsFile->addError($error, $stackPtr, $type, $data);
          } else {
              $phpcsFile->addWarning($error, $stackPtr, $type, $data);
          }
  
      }
code_tokens: protected function addError ( $ phpcsFile , $ stackPtr , $ function , $ pattern = null ) { $ data = array ( $ function ) ; $ error = 'The use of function %s() is ' ; if ( $ this -> error === true ) { $ type = 'Found' ; $ error .= 'forbidden' ; } else { $ type = 'Discouraged' ; $ error .= 'discouraged' ; } if ( $ pattern === null ) { $ pattern = $ function ; } if ( $ this -> forbiddenFunctions [ $ pattern ] !== null && $ this -> forbiddenFunctions [ $ pattern ] !== 'null' ) { $ type .= 'WithAlternative' ; $ data [ ] = $ this -> forbiddenFunctions [ $ pattern ] ; $ error .= '; use %s() instead' ; } if ( $ this -> error === true ) { $ phpcsFile -> addError ( $ error , $ stackPtr , $ type , $ data ) ; } else { $ phpcsFile -> addWarning ( $ error , $ stackPtr , $ type , $ data ) ; } }
docstring: Generates the error or warning for this sniff.
  
  @param File   $phpcsFile The file being scanned.
  @param int    $stackPtr  The position of the forbidden function
  in the token array.
  @param string $function  The name of the forbidden function.
  @param string $pattern   The pattern used for the match.
  
  @return void
docstring_tokens: Generates the error or warning for this sniff .