Skip to content

Commit eb21d52

Browse files
committed
Fix code style issues
- Remove trailing whitespace on blank lines - Add periods to PHPDoc summaries
1 parent f06e5c5 commit eb21d52

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed

src/Subscriber/AutoUpdateTitleWithLabelSubscriber.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ public function onPullRequest(GitHubEvent $event): void
7878
// Extract any bracketed text at the beginning of the title
7979
$leadingBrackets = '';
8080
$remainingTitle = $prTitle;
81-
81+
8282
// Match all consecutive bracketed items at the start of the title
8383
while (preg_match('/^\[([^]]+)]\s*/', $remainingTitle, $matches)) {
8484
$leadingBrackets .= '['.$matches[1].']';
8585
$remainingTitle = substr($remainingTitle, strlen($matches[0]));
8686
}
87-
87+
8888
// Combine: valid labels + any unrecognized brackets + remaining title
8989
if ('' !== trim($remainingTitle)) {
9090
$prTitle = $prPrefix.$leadingBrackets.' '.trim($remainingTitle);

tests/Subscriber/AutoUpdateTitleWithLabelSubscriberTest.php

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -219,18 +219,19 @@ public function testBugWithLabelsNotInRepositoryLabelList()
219219

220220
$this->dispatcher->dispatch($event, GitHubEvents::PULL_REQUEST);
221221
$responseData = $event->getResponseData();
222-
222+
223+
// The bug would cause this to be '[Platform] [Agent] Foo Bar'
223224
// because the labels are added with concatenation but not recognized
224225
// for removal from the title
225226
$this->assertCount(2, $responseData);
226227
$this->assertSame(1234, $responseData['pull_request']);
227-
228+
228229
// This is what SHOULD happen (labels concatenated without spaces)
229230
$this->assertSame('[Agent][Platform] Foo Bar', $responseData['new_title']);
230231
}
231232

232233
/**
233-
* Test that ensures no spaces are ever added between label brackets
234+
* Test that ensures no spaces are ever added between label brackets.
234235
*/
235236
public function testNoSpacesBetweenLabelBrackets()
236237
{
@@ -246,15 +247,15 @@ public function testNoSpacesBetweenLabelBrackets()
246247

247248
$this->dispatcher->dispatch($event, GitHubEvents::PULL_REQUEST);
248249
$responseData = $event->getResponseData();
249-
250+
250251
// Should produce labels without spaces and no trailing space
251252
$this->assertCount(2, $responseData);
252253
$this->assertSame(1234, $responseData['pull_request']);
253254
$this->assertSame('[Console][FrameworkBundle]', $responseData['new_title']);
254255
}
255256

256257
/**
257-
* Test when title has unrecognized bracketed text like [Foo] that isn't a label
258+
* Test when title has unrecognized bracketed text like [Foo] that isn't a label.
258259
*/
259260
public function testUnrecognizedBracketedTextWithNewLabel()
260261
{
@@ -268,7 +269,7 @@ public function testUnrecognizedBracketedTextWithNewLabel()
268269

269270
$this->dispatcher->dispatch($event, GitHubEvents::PULL_REQUEST);
270271
$responseData = $event->getResponseData();
271-
272+
272273
// Currently produces: [Console] [Foo] Bar (with space)
273274
// Should produce: [Console][Foo] Bar (no space between brackets)
274275
$this->assertCount(2, $responseData);
@@ -277,7 +278,7 @@ public function testUnrecognizedBracketedTextWithNewLabel()
277278
}
278279

279280
/**
280-
* Test multiple unrecognized bracketed texts with real labels
281+
* Test multiple unrecognized bracketed texts with real labels.
281282
*/
282283
public function testMultipleUnrecognizedBracketsWithRealLabels()
283284
{
@@ -292,7 +293,7 @@ public function testMultipleUnrecognizedBracketsWithRealLabels()
292293

293294
$this->dispatcher->dispatch($event, GitHubEvents::PULL_REQUEST);
294295
$responseData = $event->getResponseData();
295-
296+
296297
// Should keep unrecognized brackets but without spaces between any brackets
297298
$this->assertCount(2, $responseData);
298299
$this->assertSame(1234, $responseData['pull_request']);

0 commit comments

Comments
 (0)