Skip to content

Commit 508af53

Browse files
authored
Unify number of newlines in loaders (#43)
1 parent 15b823b commit 508af53

File tree

5 files changed

+5
-3
lines changed

5 files changed

+5
-3
lines changed

src/BaselinePerIdentifierFormatter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ public function formatErrors(
120120
}
121121

122122
$plurality = $totalErrorsCount === 1 ? '' : 's';
123-
$prefix = "# total $totalErrorsCount error$plurality\n";
123+
$prefix = "# total $totalErrorsCount error$plurality\n\n";
124124
$writtenLoader = file_put_contents($this->baselinesDir . '/loader.neon', $prefix . NeonHelper::encode(['includes' => $includes], $this->indent));
125125

126126
if ($writtenLoader === false) {

src/Handler/NeonBaselineHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function encodeBaselineLoader(
4545
string $indent
4646
): string
4747
{
48-
$prefix = $comment !== null ? "# $comment\n" : '';
48+
$prefix = $comment !== null ? "# $comment\n\n" : '';
4949
return $prefix . NeonHelper::encode(['includes' => $filePaths], $indent);
5050
}
5151

src/Handler/PhpBaselineHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function encodeBaselineLoader(
6969
$php = "<?php declare(strict_types = 1);\n\n";
7070

7171
if ($comment !== null) {
72-
$php .= "// $comment\n";
72+
$php .= "// $comment\n\n";
7373
}
7474

7575
$php .= "return ['includes' => [\n";

tests/Rule/data/baselines-neon/loader.neon

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
# total 4 errors
2+
23
includes:
34
- another.identifier.neon
45
- missing-identifier.neon

tests/Rule/data/baselines-php/loader.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
<?php declare(strict_types = 1);
22

33
// total 4 errors
4+
45
return ['includes' => [
56
__DIR__ . '/another.identifier.php',
67
__DIR__ . '/missing-identifier.php',

0 commit comments

Comments
 (0)