File tree Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Expand file tree Collapse file tree 2 files changed +15
-4
lines changed Original file line number Diff line number Diff line change @@ -177,9 +177,15 @@ public function generate(
177
177
echo "\033[0m " .str_repeat ('- ' , $ width ).PHP_EOL ;
178
178
179
179
$ fixableSources = 0 ;
180
- $ maxSniffWidth = 37 ;
180
+
181
+ if ($ showSources === true ) {
182
+ $ maxSniffWidth = ($ width - 7 );
183
+ } else {
184
+ $ maxSniffWidth = ($ width - 37 );
185
+ }
186
+
181
187
if ($ totalFixable > 0 ) {
182
- $ maxSniffWidth + = 4 ;
188
+ $ maxSniffWidth - = 4 ;
183
189
}
184
190
185
191
foreach ($ this ->_sourceCache as $ source => $ sourceData ) {
@@ -196,6 +202,10 @@ public function generate(
196
202
}
197
203
198
204
if ($ showSources === true ) {
205
+ if ($ sourceData ['strlen ' ] > $ maxSniffWidth ) {
206
+ $ source = substr ($ source , 0 , $ maxSniffWidth );
207
+ }
208
+
199
209
echo $ source ;
200
210
if ($ totalFixable > 0 ) {
201
211
echo str_repeat (' ' , ($ width - 9 - strlen ($ source )));
@@ -219,8 +229,8 @@ public function generate(
219
229
echo $ category .str_repeat (' ' , (20 - strlen ($ category )));
220
230
221
231
$ sniff = $ parts [2 ];
222
- if (strlen ($ sniff ) > ( $ width - $ maxSniffWidth) ) {
223
- $ sniff = substr ($ sniff , 0 , ( $ width - $ maxSniffWidth - strlen ( $ sniff )) );
232
+ if (strlen ($ sniff ) > $ maxSniffWidth ) {
233
+ $ sniff = substr ($ sniff , 0 , $ maxSniffWidth );
224
234
}
225
235
226
236
if ($ totalFixable > 0 ) {
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
28
28
<notes >
29
29
- Fixed bug #625 : Consider working around T_HASHBANG in HHVM 3.5.x and 3.6.x
30
30
-- Thanks to Kunal Mehta for the patch
31
+ - Fixed bug #694 : Long sniff codes can cause PHP warnings in source report when showing error codes
31
32
</notes >
32
33
<contents >
33
34
<dir name =" /" >
You can’t perform that action at this time.
0 commit comments