File tree 2 files changed +12
-10
lines changed
src/Command/ErrorFormatter
tests/PHPStan/Command/ErrorFormatter
2 files changed +12
-10
lines changed Original file line number Diff line number Diff line change 16
16
use function in_array ;
17
17
use function is_string ;
18
18
use function ltrim ;
19
+ use function rtrim ;
19
20
use function sprintf ;
20
21
use function str_contains ;
21
22
use function str_replace ;
@@ -83,7 +84,7 @@ public function formatErrors(
83
84
$ filePath = $ error ->getTraitFilePath () ?? $ error ->getFilePath ();
84
85
if ($ error ->getIdentifier () !== null && $ error ->canBeIgnored ()) {
85
86
$ message .= "\n" ;
86
- $ message .= '🪪 ' . $ error ->getIdentifier ();
87
+ $ message .= '🪪 ' . $ error ->getIdentifier ();
87
88
}
88
89
if ($ error ->getTip () !== null ) {
89
90
$ tip = $ error ->getTip ();
@@ -95,6 +96,7 @@ public function formatErrors(
95
96
foreach ($ lines as $ line ) {
96
97
$ message .= '💡 ' . ltrim ($ line , ' • ' ) . "\n" ;
97
98
}
99
+ $ message = rtrim ($ message , "\n" );
98
100
} else {
99
101
$ message .= '💡 ' . $ tip ;
100
102
}
@@ -116,7 +118,7 @@ public function formatErrors(
116
118
$ title = $ this ->relativePathHelper ->getRelativePath ($ filePath );
117
119
}
118
120
119
- $ message .= "\n✏️ <href= " . OutputFormatter::escape ($ url ) . '> ' . $ title . '</> ' ;
121
+ $ message .= "\n✏️ <href= " . OutputFormatter::escape ($ url ) . '> ' . $ title . '</> ' ;
120
122
}
121
123
122
124
if (
Original file line number Diff line number Diff line change @@ -190,13 +190,13 @@ public function dataFormatterOutputProvider(): iterable
190
190
'numGenericErrors ' => 0 ,
191
191
'verbose ' => false ,
192
192
'extraEnvVars ' => [],
193
- 'expected ' => ' ------ ----------------
193
+ 'expected ' => ' ------ ---------------
194
194
Line foo.php
195
- ------ ----------------
195
+ ------ ---------------
196
196
5 Foobar\Buz
197
- 🪪 foobar.buz
197
+ 🪪 foobar.buz
198
198
💡 a tip
199
- ------ ----------------
199
+ ------ ---------------
200
200
201
201
202
202
[ERROR] Found 1 error
@@ -211,13 +211,13 @@ public function dataFormatterOutputProvider(): iterable
211
211
'numGenericErrors ' => 0 ,
212
212
'verbose ' => true ,
213
213
'extraEnvVars ' => [],
214
- 'expected ' => ' ------ ----------------
214
+ 'expected ' => ' ------ ---------------
215
215
Line foo.php
216
- ------ ----------------
216
+ ------ ---------------
217
217
5 Foobar\Buz
218
- 🪪 foobar.buz
218
+ 🪪 foobar.buz
219
219
💡 a tip
220
- ------ ----------------
220
+ ------ ---------------
221
221
222
222
223
223
[ERROR] Found 1 error
You can’t perform that action at this time.
0 commit comments