@@ -29,9 +29,6 @@ public function __construct(CachedLabelsApi $labelsApi)
2929 $ this ->labelsApi = $ labelsApi ;
3030 }
3131
32- /**
33- * @param GitHubEvent $event
34- */
3532 public function onPullRequest (GitHubEvent $ event )
3633 {
3734 $ data = $ event ->getData ();
@@ -42,7 +39,7 @@ public function onPullRequest(GitHubEvent $event)
4239 $ prNumber = $ data ['pull_request ' ]['number ' ];
4340 $ prTitle = $ data ['pull_request ' ]['title ' ];
4441 $ prBody = $ data ['pull_request ' ]['body ' ];
45- $ prLabels = array () ;
42+ $ prLabels = [] ;
4643
4744 // the PR title usually contains one or more labels
4845 foreach ($ this ->extractLabels ($ prTitle ) as $ label ) {
@@ -65,21 +62,21 @@ public function onPullRequest(GitHubEvent $event)
6562
6663 $ this ->labelsApi ->addIssueLabels ($ prNumber , $ prLabels , $ event ->getRepository ());
6764
68- $ event ->setResponseData (array (
65+ $ event ->setResponseData ([
6966 'pull_request ' => $ prNumber ,
7067 'pr_labels ' => $ prLabels ,
71- ) );
68+ ] );
7269 }
7370
7471 private function extractLabels ($ prTitle )
7572 {
76- $ labels = array () ;
73+ $ labels = [] ;
7774
7875 // e.g. "[PropertyAccess] [RFC] [WIP] Allow custom methods on property accesses"
7976 if (preg_match_all ('/\[(?P<labels>.+)\]/U ' , $ prTitle , $ matches )) {
8077 // creates a key=>val array, but the key is lowercased
8178 $ validLabels = array_combine (
82- array_map (function ($ s ) {
79+ array_map (function ($ s ) {
8380 return strtolower ($ s );
8481 }, $ this ->getValidLabels ()),
8582 $ this ->getValidLabels ()
@@ -103,7 +100,7 @@ private function extractLabels($prTitle)
103100 */
104101 private function getValidLabels ()
105102 {
106- $ realLabels = array (
103+ $ realLabels = [
107104 'Asset ' , 'BC Break ' , 'BrowserKit ' , 'Bug ' , 'Cache ' , 'Config ' , 'Console ' ,
108105 'Contracts ' , 'Critical ' , 'CssSelector ' , 'Debug ' , 'DebugBundle ' , 'DependencyInjection ' ,
109106 'Deprecation ' , 'Doctrine ' , 'DoctrineBridge ' , 'DomCrawler ' , 'Dotenv ' ,
@@ -117,7 +114,7 @@ private function getValidLabels()
117114 'Translator ' , 'TwigBridge ' , 'TwigBundle ' , 'Uid ' , 'Validator ' , 'VarDumper ' ,
118115 'VarExporter ' , 'WebLink ' , 'WebProfilerBundle ' , 'WebServerBundle ' , 'Workflow ' ,
119116 'Yaml ' ,
120- ) ;
117+ ] ;
121118
122119 return array_merge (
123120 $ realLabels ,
@@ -143,8 +140,8 @@ private function fixLabelName($label)
143140
144141 public static function getSubscribedEvents ()
145142 {
146- return array (
143+ return [
147144 GitHubEvents::PULL_REQUEST => 'onPullRequest ' ,
148- ) ;
145+ ] ;
149146 }
150147}
0 commit comments