@@ -16,6 +16,7 @@ class BreakingChangeTableReporter extends TableReporter
1616 private $ breakChangeLevels = [
1717 Level::MAJOR ,
1818 Level::MINOR ,
19+ Level::PATCH ,
1920 ];
2021
2122 /**
@@ -96,7 +97,7 @@ private function outputChangeReport(OutputInterface $output, Report $report, $co
9697 protected function outputTable (OutputInterface $ output , Report $ report , $ context )
9798 {
9899 $ 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> ' ]);
100101 $ rows = [];
101102 foreach (Level::asList ('desc ' ) as $ level ) {
102103 if (!in_array ($ level , $ this ->breakChangeLevels )) {
@@ -105,15 +106,36 @@ protected function outputTable(OutputInterface $output, Report $report, $context
105106 $ reportForLevel = $ report [$ context ][$ level ];
106107 /** @var \PHPSemVerChecker\Operation\Operation $operation */
107108 foreach ($ reportForLevel as $ operation ) {
109+ $ levelLabel = $ this ->getLevelLabel ($ level );
108110 $ target = $ operation ->getTarget ();
109111 $ reason = $ operation ->getReason ();
110- $ rows [] = [$ target , $ reason ];
112+ $ rows [] = [$ levelLabel , $ target , $ reason ];
111113 }
112114 }
113115 $ table ->setRows ($ rows );
114116 $ table ->render ();
115117 }
116118
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+
117139 /**
118140 * Generate the HTML header line for a report section
119141 *
0 commit comments