@@ -16,6 +16,7 @@ class BreakingChangeTableReporter extends TableReporter
16
16
private $ breakChangeLevels = [
17
17
Level::MAJOR ,
18
18
Level::MINOR ,
19
+ Level::PATCH ,
19
20
];
20
21
21
22
/**
@@ -96,7 +97,7 @@ private function outputChangeReport(OutputInterface $output, Report $report, $co
96
97
protected function outputTable (OutputInterface $ output , Report $ report , $ context )
97
98
{
98
99
$ table = new HtmlTableRenderer ($ output );
99
- $ table ->setHeaders (['What changed ' , 'How it changed ' ]);
100
+ $ table ->setHeaders (['<strong>Change Level</strong> ' , ' <strong> What Changed</strong> ' , '<strong> How It Changed</strong> ' ]);
100
101
$ rows = [];
101
102
foreach (Level::asList ('desc ' ) as $ level ) {
102
103
if (!in_array ($ level , $ this ->breakChangeLevels )) {
@@ -105,15 +106,36 @@ protected function outputTable(OutputInterface $output, Report $report, $context
105
106
$ reportForLevel = $ report [$ context ][$ level ];
106
107
/** @var \PHPSemVerChecker\Operation\Operation $operation */
107
108
foreach ($ reportForLevel as $ operation ) {
109
+ $ levelLabel = $ this ->getLevelLabel ($ level );
108
110
$ target = $ operation ->getTarget ();
109
111
$ reason = $ operation ->getReason ();
110
- $ rows [] = [$ target , $ reason ];
112
+ $ rows [] = [$ levelLabel , $ target , $ reason ];
111
113
}
112
114
}
113
115
$ table ->setRows ($ rows );
114
116
$ table ->render ();
115
117
}
116
118
119
+ /**
120
+ * Get a human-readable label for the change level
121
+ *
122
+ * @param int $level
123
+ * @return string
124
+ */
125
+ private function getLevelLabel (int $ level ): string
126
+ {
127
+ switch ($ level ) {
128
+ case Level::MAJOR :
129
+ return '<span style="color: #d73a49; font-weight: bold;">MAJOR (Breaking)</span> ' ;
130
+ case Level::MINOR :
131
+ return '<span style="color: #f6a434; font-weight: bold;">MINOR (Non-breaking)</span> ' ;
132
+ case Level::PATCH :
133
+ return '<span style="color: #28a745; font-weight: bold;">PATCH</span> ' ;
134
+ default :
135
+ return 'UNKNOWN ' ;
136
+ }
137
+ }
138
+
117
139
/**
118
140
* Generate the HTML header line for a report section
119
141
*
0 commit comments