Skip to content

Commit e39e9b7

Browse files
committed
Differ cannot be a service after all
1 parent 39659f4 commit e39e9b7

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

conf/services.neon

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -160,17 +160,6 @@ services:
160160
-
161161
class: PHPStan\Rules\Properties\UninitializedPropertyRule
162162

163-
-
164-
class: SebastianBergmann\Diff\Differ
165-
arguments:
166-
outputBuilder: @SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder
167-
168-
-
169-
class: SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder
170-
arguments:
171-
header: ''
172-
addLineNumbers: true
173-
174163
betterReflectionSourceLocator:
175164
class: PHPStan\BetterReflection\SourceLocator\Type\SourceLocator
176165
factory: @PHPStan\Reflection\BetterReflection\BetterReflectionSourceLocatorFactory::create

src/Analyser/RuleErrorTransformer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,21 @@
2323
use PHPStan\Rules\TipRuleError;
2424
use PHPStan\ShouldNotHappenException;
2525
use SebastianBergmann\Diff\Differ;
26+
use SebastianBergmann\Diff\Output\UnifiedDiffOutputBuilder;
2627
use function get_class;
2728
use function sha1;
2829
use function str_repeat;
2930

3031
final class RuleErrorTransformer
3132
{
3233

34+
private Differ $differ;
35+
3336
public function __construct(
3437
private Parser $parser,
35-
private Differ $differ,
3638
)
3739
{
40+
$this->differ = new Differ(new UnifiedDiffOutputBuilder('', addLineNumbers: true));
3841
}
3942

4043
/**

src/Fixable/Patcher.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
final class Patcher
2626
{
2727

28-
public function __construct(private Differ $differ)
28+
private Differ $differ;
29+
30+
public function __construct()
2931
{
32+
$this->differ = new Differ();
3033
}
3134

3235
/**

0 commit comments

Comments
 (0)