Skip to content

Commit 92dd311

Browse files
committed
don't assume numeric line numbers
1 parent ec38580 commit 92dd311

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

CodeSniffer/Reports/Full.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,14 +78,7 @@ public function generateFileReport(
7878
echo str_repeat('-', $width).PHP_EOL;
7979

8080
// Work out the max line number for formatting.
81-
$maxLine = 0;
82-
foreach ($report['messages'] as $line => $lineErrors) {
83-
if ($line > $maxLine) {
84-
$maxLine = $line;
85-
}
86-
}
87-
88-
$maxLineLength = strlen($maxLine);
81+
$maxLineLength = max(array_map('strlen', array_keys($report['messages'])));
8982

9083
// The length of the word ERROR or WARNING; used for padding.
9184
if ($report['warnings'] > 0) {

0 commit comments

Comments
 (0)