Skip to content

Commit 7dd3e79

Browse files
committed
Fix standards
1 parent cb7a2a3 commit 7dd3e79

File tree

7 files changed

+36
-40
lines changed

7 files changed

+36
-40
lines changed

src/AppBundle/Controller/DefaultController.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
namespace AppBundle\Controller;
44

5-
use AppBundle\Issues\IssueListener;
6-
use AppBundle\Issues\Status;
75
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
86
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
97

src/AppBundle/Controller/WebhookController.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
namespace AppBundle\Controller;
44

5-
use AppBundle\Issues\IssueListener;
65
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
76
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
87
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
@@ -47,7 +46,7 @@ public function githubAction(Request $request)
4746
break;
4847
default:
4948
$responseData = [
50-
'unsupported_action' => $data['action']
49+
'unsupported_action' => $data['action'],
5150
];
5251
}
5352
break;
@@ -64,13 +63,13 @@ public function githubAction(Request $request)
6463
break;
6564
default:
6665
$responseData = [
67-
'unsupported_action' => $data['action']
66+
'unsupported_action' => $data['action'],
6867
];
6968
}
7069
break;
7170
default:
7271
$responseData = [
73-
'unsupported_event' => $event
72+
'unsupported_event' => $event,
7473
];
7574
}
7675

src/AppBundle/Issues/GitHub/CachedLabelsApi.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,4 @@ public function removeIssueLabel($issueNumber, $label)
9393
unset($this->labelCache[$issueNumber][$label]);
9494
}
9595
}
96-
9796
}

src/AppBundle/Issues/GitHub/GitHubStatusApi.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ public function __construct(CachedLabelsApi $labelsApi, $repositoryUsername, $re
4040
}
4141

4242
/**
43-
* @param integer $issueNumber The GitHub issue number
44-
* @param string $newStatus A Status::* constant
43+
* @param int $issueNumber The GitHub issue number
44+
* @param string $newStatus A Status::* constant
4545
*/
4646
public function setIssueStatus($issueNumber, $newStatus)
4747
{
@@ -85,7 +85,7 @@ public function getIssueStatus($issueNumber)
8585
}
8686

8787
// No status set
88-
return null;
88+
return;
8989
}
9090

9191
public function getNeedsReviewUrl()

src/AppBundle/Issues/IssueListener.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ public function handleCommentAddedEvent($issueNumber, $comment)
5151
return $newStatus;
5252
}
5353

54-
return null;
54+
return;
5555
}
5656

5757
/**
58-
* Adds a "Needs Review" label to new PRs
58+
* Adds a "Needs Review" label to new PRs.
5959
*
6060
* @param int $prNumber The number of the PR
6161
*
@@ -71,7 +71,7 @@ public function handlePullRequestCreatedEvent($prNumber)
7171
}
7272

7373
/**
74-
* Changes "Bug" issues to "Needs Review"
74+
* Changes "Bug" issues to "Needs Review".
7575
*
7676
* @param int $issueNumber The issue that was labeled
7777
* @param string $label The added label
@@ -82,14 +82,14 @@ public function handleLabelAddedEvent($issueNumber, $label)
8282
{
8383
// Ignore non-bugs
8484
if ('bug' !== strtolower($label)) {
85-
return null;
85+
return;
8686
}
8787

8888
$currentStatus = $this->statusApi->getIssueStatus($issueNumber);
8989

9090
// Ignore if the issue already has a status
9191
if (null !== $currentStatus) {
92-
return null;
92+
return;
9393
}
9494

9595
$newStatus = Status::NEEDS_REVIEW;

src/AppBundle/Tests/Controller/WebhookControllerTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,24 @@ public function getTests()
2929
$tests[] = array(
3030
'issue_comment',
3131
'issue_comment.created.json',
32-
array('status_change' => 'needs_review', 'issue' => 1)
32+
array('status_change' => 'needs_review', 'issue' => 1),
3333
);
3434
$tests[] = array(
3535
'pull_request',
3636
'pull_request.opened.json',
37-
array('status_change' => 'needs_review', 'pull_request' => 3)
37+
array('status_change' => 'needs_review', 'pull_request' => 3),
3838
);
3939
$tests[] = array(
4040
'issues',
4141
'issues.labeled.bug.json',
42-
array('status_change' => 'needs_review', 'issue' => 5)
42+
array('status_change' => 'needs_review', 'issue' => 5),
4343
);
4444
$tests[] = array(
4545
'issues',
4646
'issues.labeled.feature.json',
47-
array('status_change' => null, 'issue' => 5)
47+
array('status_change' => null, 'issue' => 5),
4848
);
4949

5050
return $tests;
5151
}
52-
}
52+
}

src/AppBundle/Tests/Issues/IssueListenerTest.php

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -48,74 +48,74 @@ public function getCommentsForStatusChange()
4848
$tests = [];
4949
$tests[] = array(
5050
'Have a great day!',
51-
null
51+
null,
5252
);
5353
// basic tests for status change
5454
$tests[] = array(
5555
'Status: needs review',
56-
Status::NEEDS_REVIEW
56+
Status::NEEDS_REVIEW,
5757
);
5858
$tests[] = array(
5959
'Status: needs work',
60-
Status::NEEDS_WORK
60+
Status::NEEDS_WORK,
6161
);
6262
$tests[] = array(
6363
'Status: reviewed',
64-
Status::REVIEWED
64+
Status::REVIEWED,
6565
);
6666

6767
// accept quotes
6868
$tests[] = array(
6969
'Status: "reviewed"',
70-
Status::REVIEWED
70+
Status::REVIEWED,
7171
);
7272
$tests[] = array(
7373
"Status: 'reviewed'",
74-
Status::REVIEWED
74+
Status::REVIEWED,
7575
);
7676

7777
// accept trailing punctuation
7878
$tests[] = array(
7979
'Status: works for me!',
80-
Status::WORKS_FOR_ME
80+
Status::WORKS_FOR_ME,
8181
);
8282
$tests[] = array(
8383
'Status: works for me.',
84-
Status::WORKS_FOR_ME
84+
Status::WORKS_FOR_ME,
8585
);
8686

8787
// play with different formatting
8888
$tests[] = array(
8989
'STATUS: REVIEWED',
90-
Status::REVIEWED
90+
Status::REVIEWED,
9191
);
9292
$tests[] = array(
9393
'**Status**: reviewed',
94-
Status::REVIEWED
94+
Status::REVIEWED,
9595
);
9696
$tests[] = array(
9797
'**Status:** reviewed',
98-
Status::REVIEWED
98+
Status::REVIEWED,
9999
);
100100
$tests[] = array(
101101
'**Status: reviewed**',
102-
Status::REVIEWED
102+
Status::REVIEWED,
103103
);
104104
$tests[] = array(
105105
'**Status: reviewed!**',
106-
Status::REVIEWED
106+
Status::REVIEWED,
107107
);
108108
$tests[] = array(
109109
'**Status: reviewed**.',
110-
Status::REVIEWED
110+
Status::REVIEWED,
111111
);
112112
$tests[] = array(
113113
'Status:reviewed',
114-
Status::REVIEWED
114+
Status::REVIEWED,
115115
);
116116
$tests[] = array(
117117
'Status: reviewed',
118-
Status::REVIEWED
118+
Status::REVIEWED,
119119
);
120120

121121
// reject missing colon
@@ -127,24 +127,24 @@ public function getCommentsForStatusChange()
127127
// multiple matches - use the last one
128128
$tests[] = array(
129129
"Status: needs review \r\n that is what the issue *was* marked as.\r\n Status: reviewed",
130-
Status::REVIEWED
130+
Status::REVIEWED,
131131
);
132132
// "needs review" does not come directly after status: , so there is no status change
133133
$tests[] = array(
134134
'Here is my status: I\'m really happy! I realize this needs review, but I\'m, having too much fun Googling cats!',
135-
null
135+
null,
136136
);
137137

138138
// reject if the status is not on a line of its own
139139
// use case: someone posts instructions about how to change a status
140140
// in a comment
141141
$tests[] = array(
142142
'You should include e.g. the line `Status: needs review` in your comment',
143-
null
143+
null,
144144
);
145145
$tests[] = array(
146146
'Before the ticket was in state "Status: reviewed", but then the status was changed',
147-
null
147+
null,
148148
);
149149

150150
return $tests;

0 commit comments

Comments
 (0)