File tree Expand file tree Collapse file tree 2 files changed +38
-0
lines changed
src/Command/ErrorFormatter Expand file tree Collapse file tree 2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -2174,3 +2174,9 @@ services:
21742174 class : PHPStan\Command\ErrorFormatter\TeamcityErrorFormatter
21752175 arguments :
21762176 relativePathHelper : @simpleRelativePathHelper
2177+
2178+ errorFormatter.multiple :
2179+ class : PHPStan\Command\ErrorFormatter\ChainErrorFormatter
2180+ arguments :
2181+ formatters :
2182+ - @errorFormatter.table
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace PHPStan \Command \ErrorFormatter ;
4+
5+ use PHPStan \Command \AnalysisResult ;
6+ use PHPStan \Command \Output ;
7+
8+ /**
9+ * @api
10+ */
11+ final class ChainErrorFormatter implements ErrorFormatter
12+ {
13+
14+ /**
15+ * @param list<ErrorFormatter> $formatters
16+ */
17+ public function __construct (
18+ private array $ formatters ,
19+ )
20+ {
21+ }
22+
23+ public function formatErrors (AnalysisResult $ analysisResult , Output $ output ): int
24+ {
25+ foreach ($ this ->formatters as $ errorFormatter ) {
26+ $ errorFormatter ->formatErrors ($ analysisResult , $ output );
27+ }
28+
29+ return $ analysisResult ->hasErrors () ? 1 : 0 ;
30+ }
31+
32+ }
You can’t perform that action at this time.
0 commit comments