private static isExcludedAnalysisFile ( string $file_path ) : boolean | ||
$file_path | string | |
Résultat | boolean | True if this file is a member of a third party directory as configured via the CLI flag '-3 [paths]'. |
/** * @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]; } }
/** * @param int $etype * The error type such as Log::EUNDEF. * * @param string $msg * The error message * * @param string $file * The name of the file with the issue * * @param int|null $lineno * The line number where the issue occurs */ public static function err(int $etype, string $msg, string $file = null, $lineno = 0) { $log = self::getInstance(); $lineno = (int) $lineno; if ($etype == self::EFATAL) { self::display(); // Something went wrong - abort if ($file) { throw new \Exception("{$file}:{$lineno} {$msg}"); } else { throw new \Exception($msg); } } // Don't report anything for excluded files if (Phan::isExcludedAnalysisFile($file)) { return; } // If configured to do so, prepend the message // with a trace ID which indicates where the issue // came from allowing us to group on unique classes // of issues if (Config::get()->emit_trace_id) { $msg = self::traceId(debug_backtrace()[1]) . ' ' . $msg; } if ($etype & $log->output_mask) { $ukey = md5($file . $lineno . $etype . $msg); $log->msgs[$ukey] = ['file' => $file, 'lineno' => $lineno, 'etype' => $etype, 'msg' => $msg]; } }