예제 #1
0
파일: Log.php 프로젝트: Jvbzephir/phan
 /**
  * @param int $category
  * The category of error such as `Issue::CATEGORY_UNDEFINED`
  *
  * @param string $type
  * The error type such as `Issue::UndeclaredMethod`
  *
  * @param int $severity
  * The severity of the issue such as `Issue::SEVERITY_NORMAL`
  *
  * @param string $message
  * The error message
  *
  * @param string $file
  * The name of the file with the issue
  *
  * @param int $lineno
  * The line number where the issue occurs
  */
 public static function err(int $category, string $type, int $severity, string $message, string $file, int $lineno)
 {
     $log = self::getInstance();
     // Don't report anything for excluded files
     if (Phan::isExcludedAnalysisFile($file)) {
         return;
     }
     // Don't report anything below our minimum severity
     // threshold
     if ($severity < Config::get()->minimum_severity) {
         return;
     }
     if ($category & $log->output_mask) {
         // This needs to be a sortable key so that output
         // is in the expected order
         $ukey = implode('|', [$file, str_pad((string) $lineno, 5, '0', STR_PAD_LEFT), $type, $message]);
         $log->msgs[$ukey] = ['file' => $file, 'lineno' => $lineno, 'category' => $category, 'type' => $type, 'severity' => $severity, 'message' => $message];
     }
 }
예제 #2
0
 /**
  * @param string $type
  * The type of the issue
  *
  * @param string $file
  * The name of the file where the issue was found
  *
  * @param int $line
  * The line number (start) where the issue was found
  *
  * @param mixed $template_parameters
  * Any template parameters required for the issue
  * message
  *
  * @return void
  */
 public static function emit(string $type, string $file, int $line, ...$template_parameters)
 {
     $issue = self::fromType($type);
     // Temporary hack for WI-27451 https://youtrack.jetbrains.com/issue/WI-27451
     $instance = $issue($file, $line, $template_parameters);
     Phan::getIssueCollector()->collectIssue($instance);
 }