Skip to content

Commit 0018a36

Browse files
committed
fix count
1 parent 62b8229 commit 0018a36

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

src/Command/ErrorFormatter/TableErrorFormatter.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
use PHPStan\File\SimpleRelativePathHelper;
1313
use Symfony\Component\Console\Formatter\OutputFormatter;
1414
use function array_map;
15+
use function array_slice;
1516
use function count;
1617
use function explode;
1718
use function getenv;
@@ -159,12 +160,15 @@ public function formatErrors(
159160
];
160161
}
161162

162-
$style->table(['Line', $this->relativePathHelper->getRelativePath($file)], $rows);
163163
$printedErrors += count($rows);
164-
165164
if ($errorsBudget > 0 && $printedErrors > $errorsBudget) {
165+
$rows = array_slice($rows, 0, $errorsBudget - ($printedErrors - count($rows)));
166+
167+
$style->table(['Line', $this->relativePathHelper->getRelativePath($file)], $rows);
166168
break;
167169
}
170+
171+
$style->table(['Line', $this->relativePathHelper->getRelativePath($file)], $rows);
168172
}
169173

170174
if (count($analysisResult->getNotFileSpecificErrors()) > 0) {

0 commit comments

Comments
 (0)