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

Breadcrumb

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

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

Gitlab

Namespace

Micheh\PhpCodeSniffer\Report

Code

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;
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal