Skip to content

Commit 9994f3f

Browse files
committed
Allow gitlab ci to be detected
1 parent 970117e commit 9994f3f

File tree

3 files changed

+6
-0
lines changed

3 files changed

+6
-0
lines changed

src/Command/ErrorFormatter/CiDetectedErrorFormatter.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ class CiDetectedErrorFormatter implements ErrorFormatter
1717
public function __construct(
1818
private GithubErrorFormatter $githubErrorFormatter,
1919
private TeamcityErrorFormatter $teamcityErrorFormatter,
20+
private GitlabErrorFormatter $gitlabErrorFormatter,
2021
)
2122
{
2223
}
@@ -31,6 +32,8 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output): in
3132
return $this->githubErrorFormatter->formatErrors($analysisResult, $output);
3233
} elseif ($ci->getCiName() === CiDetector::CI_TEAMCITY) {
3334
return $this->teamcityErrorFormatter->formatErrors($analysisResult, $output);
35+
} elseif ($ci->getCiName() === CiDetector::CI_GITLAB) {
36+
return $this->gitlabErrorFormatter->formatErrors($analysisResult, $output);
3437
}
3538
} catch (CiNotDetectedException) {
3639
// pass

tests/PHPStan/Command/AnalyseApplicationIntegrationTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use PHPStan\Analyser\ResultCache\ResultCacheClearer;
66
use PHPStan\Command\ErrorFormatter\CiDetectedErrorFormatter;
77
use PHPStan\Command\ErrorFormatter\GithubErrorFormatter;
8+
use PHPStan\Command\ErrorFormatter\GitlabErrorFormatter;
89
use PHPStan\Command\ErrorFormatter\TableErrorFormatter;
910
use PHPStan\Command\ErrorFormatter\TeamcityErrorFormatter;
1011
use PHPStan\Command\Symfony\SymfonyOutput;
@@ -74,6 +75,7 @@ private function runPath(string $path, int $expectedStatusCode): string
7475
new CiDetectedErrorFormatter(
7576
new GithubErrorFormatter($relativePathHelper),
7677
new TeamcityErrorFormatter($relativePathHelper),
78+
new GitlabErrorFormatter($relativePathHelper),
7779
),
7880
false,
7981
null,

tests/PHPStan/Command/ErrorFormatter/TableErrorFormatterTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -325,6 +325,7 @@ private function createErrorFormatter(?string $editorUrl, ?string $editorUrlTitl
325325
new CiDetectedErrorFormatter(
326326
new GithubErrorFormatter($relativePathHelper),
327327
new TeamcityErrorFormatter($relativePathHelper),
328+
new GitlabErrorFormatter($relativePathHelper),
328329
),
329330
false,
330331
$editorUrl,

0 commit comments

Comments
 (0)