@@ -14,6 +14,14 @@ class AutoLabelPRFromContentSubscriber implements EventSubscriberInterface
1414{
1515 private $ labelsApi ;
1616
17+ private static $ labelAliases = [
18+ 'di ' => 'DependencyInjection ' ,
19+ 'bridge\twig ' => 'TwigBridge ' ,
20+ 'router ' => 'Routing ' ,
21+ 'translation ' => 'Translator ' ,
22+ 'twig bridge ' => 'TwigBridge ' ,
23+ ];
24+
1725 public function __construct (CachedLabelsApi $ labelsApi )
1826 {
1927 $ this ->labelsApi = $ labelsApi ;
@@ -95,7 +103,7 @@ private function extractLabels($prTitle)
95103 */
96104 private function getValidLabels ()
97105 {
98- return array (
106+ $ realLabels = array (
99107 'Asset ' , 'BC Break ' , 'BrowserKit ' , 'Bug ' , 'Cache ' , 'ClassLoader ' ,
100108 'Config ' , 'Console ' , 'Critical ' , 'CssSelector ' , 'Debug ' , 'DebugBundle ' ,
101109 'DependencyInjection ' , 'Deprecation ' , 'Doctrine ' , 'DoctrineBridge ' ,
@@ -109,6 +117,12 @@ private function getValidLabels()
109117 'Unconfirmed ' , 'Validator ' , 'VarDumper ' , 'WebProfilerBundle ' , 'Workflow ' ,
110118 'Yaml ' ,
111119 );
120+
121+ return array_merge (
122+ $ realLabels ,
123+ // also consider the "aliases" as valid, so they are used
124+ array_keys (self ::$ labelAliases )
125+ );
112126 }
113127
114128 /**
@@ -117,15 +131,9 @@ private function getValidLabels()
117131 */
118132 private function fixLabelName ($ label )
119133 {
120- $ labelAliases = array (
121- 'di ' => 'DependencyInjection ' ,
122- 'bridge\twig ' => 'TwigBridge ' ,
123- 'router ' => 'Routing ' ,
124- 'translation ' => 'Translator ' ,
125- 'twig bridge ' => 'TwigBridge ' ,
126- );
134+ $ labelAliases = self ::$ labelAliases ;
127135
128- if (in_array ( strtolower ($ label ), $ labelAliases )) {
136+ if (isset ( $ labelAliases [ strtolower ($ label )] )) {
129137 return $ labelAliases [strtolower ($ label )];
130138 }
131139
0 commit comments