Skip to content

Commit 615a25a

Browse files
authored
Update FriendlyErrorFormatter.php
1 parent 75050b5 commit 615a25a

File tree

1 file changed

+13
-3
lines changed

1 file changed

+13
-3
lines changed

src/FriendlyErrorFormatter.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use PHPStan\Command\ErrorFormatter\ErrorFormatter;
88
use PHPStan\Command\Output;
99
use PHPStan\File\RelativePathHelper;
10+
use PHPStan\File\SimpleRelativePathHelper;
1011
use Yamadashy\PhpStanFriendlyFormatter\Config\FriendlyFormatterConfig;
1112
use Yamadashy\PhpStanFriendlyFormatter\ErrorFormat\ErrorWriter;
1213
use Yamadashy\PhpStanFriendlyFormatter\ErrorFormat\SummaryWriter;
@@ -16,12 +17,21 @@ class FriendlyErrorFormatter implements ErrorFormatter
1617
/** @var RelativePathHelper */
1718
private $relativePathHelper;
1819

20+
/** @var SimpleRelativePathHelper */
21+
private $simpleRelativePathHelper;
22+
1923
/** @var FriendlyFormatterConfig */
2024
private $config;
2125

22-
public function __construct(RelativePathHelper $relativePathHelper, int $lineBefore, int $lineAfter, ?string $editorUrl)
23-
{
26+
public function __construct(
27+
RelativePathHelper $relativePathHelper,
28+
SimpleRelativePathHelper $simpleRelativePathHelper,
29+
int $lineBefore,
30+
int $lineAfter,
31+
?string $editorUrl
32+
) {
2433
$this->relativePathHelper = $relativePathHelper;
34+
$this->simpleRelativePathHelper = $simpleRelativePathHelper;
2535
$this->config = new FriendlyFormatterConfig(
2636
$lineBefore,
2737
$lineAfter,
@@ -40,7 +50,7 @@ public function formatErrors(AnalysisResult $analysisResult, Output $output): in
4050

4151
$output->writeLineFormatted('');
4252

43-
$errorWriter = new ErrorWriter($this->relativePathHelper, $this->config);
53+
$errorWriter = new ErrorWriter($this->relativePathHelper, $this->simpleRelativePathHelper, $this->config);
4454
$errorWriter->writeFileSpecificErrors($analysisResult, $output);
4555
$errorWriter->writeNotFileSpecificErrors($analysisResult, $output);
4656
$errorWriter->writeWarnings($analysisResult, $output);

0 commit comments

Comments
 (0)