function Gitlab::generateFileReport
@psalm-suppress ImplementedParamTypeMismatch PHP_CodeSniffer has a wrong docblock
Overrides Report::generateFileReport
File
-
vendor/
micheh/ phpcs-gitlab/ src/ Report/ Gitlab.php, line 26
Class
Namespace
Micheh\PhpCodeSniffer\ReportCode
public function generateFileReport($report, File $phpcsFile, $showSources = false, $width = 80) {
$hasOutput = false;
foreach ($report['messages'] as $line => $lineErrors) {
foreach ($lineErrors as $column => $colErrors) {
foreach ($colErrors as $error) {
$issue = [
'type' => 'issue',
'categories' => [
'Style',
],
'check_name' => $error['source'],
'fingerprint' => md5($report['filename'] . $error['message'] . $line . $column),
'severity' => $error['type'] === 'ERROR' ? 'major' : 'minor',
'description' => str_replace([
"\n",
"\r",
"\t",
], [
'\\n',
'\\r',
'\\t',
], $error['message']),
'location' => [
'path' => $report['filename'],
'lines' => [
'begin' => $line,
'end' => $line,
],
],
];
echo json_encode($issue, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE) . ',';
$hasOutput = true;
}
}
}
return $hasOutput;
}