Skip to content

Commit 33d6b06

Browse files
Add pint and run it
1 parent c1dcfea commit 33d6b06

10 files changed

+22
-50
lines changed

.scrutinizer.yml

Lines changed: 0 additions & 21 deletions
This file was deleted.

.styleci.yml

Lines changed: 0 additions & 4 deletions
This file was deleted.

composer.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@
2020
"ext-fileinfo": "*"
2121
},
2222
"require-dev": {
23+
"laravel/pint": "^1.10",
2324
"mockery/mockery": "^1.3.1",
24-
"phpunit/phpunit": "^9.3",
25-
"orchestra/testbench": "^8.0"
25+
"orchestra/testbench": "^8.0",
26+
"phpunit/phpunit": "^9.3"
2627
},
2728
"autoload": {
2829
"psr-4": {

src/Exceptions/CouldNotSendNotification.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static function serviceRespondsNotSuccessful(mixed $response): CouldNotSe
1111
if (isset($response->error)) {
1212
return new static("Couldn't post notification. Response: ".$response->error);
1313
}
14-
14+
1515
$responseBody = print_r($response->detail, true);
1616

1717
return new static("Couldn't post notification. Response: ".$responseBody);

src/TwitterChannel.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function __construct(protected TwitterOAuth $twitter)
1515
/**
1616
* Send the given notification.
1717
*
18-
* @param mixed $notifiable Should be an object that uses the Illuminate\Notifications\Notifiable trait.
18+
* @param mixed $notifiable Should be an object that uses the Illuminate\Notifications\Notifiable trait.
1919
*
2020
* @throws CouldNotSendNotification
2121
*/
@@ -40,7 +40,7 @@ public function send($notifiable, Notification $notification): array|object
4040
$requestBody,
4141
$twitterMessage->isJsonRequest,
4242
);
43-
43+
4444
if ($this->twitter->getLastHttpCode() !== 201) {
4545
throw CouldNotSendNotification::serviceRespondsNotSuccessful($this->twitter->getLastBody());
4646
}
@@ -51,7 +51,7 @@ public function send($notifiable, Notification $notification): array|object
5151
/**
5252
* Use per user settings instead of default ones.
5353
*
54-
* @param object $notifiable Provide an object that uses the Illuminate\Notifications\Notifiable trait.
54+
* @param object $notifiable Provide an object that uses the Illuminate\Notifications\Notifiable trait.
5555
*/
5656
private function changeTwitterSettingsIfNeeded(object $notifiable)
5757
{

src/TwitterServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ public function boot()
2121
config('services.twitter.access_token'),
2222
config('services.twitter.access_secret')
2323
);
24-
24+
2525
return $connection;
2626
});
2727
}

src/TwitterStatusUpdate.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,13 @@
99
class TwitterStatusUpdate extends TwitterMessage
1010
{
1111
public ?Collection $imageIds = null;
12+
1213
public ?Collection $videoIds = null;
14+
1315
private ?array $images = null;
16+
1417
private ?array $videos = null;
18+
1519
private ?int $inReplyToTweetId = null;
1620

1721
/**
@@ -90,9 +94,6 @@ public function inReplyTo(int $tweetId): self
9094
return $this;
9195
}
9296

93-
/**
94-
* @return int|null
95-
*/
9697
public function getInReplyToTweetId(): ?int
9798
{
9899
return $this->inReplyToTweetId;
@@ -112,7 +113,7 @@ public function getRequestBody(): array
112113

113114
if ($mediaIds->count() > 0) {
114115
$body['media'] = [
115-
'media_ids' => $mediaIds->toArray()
116+
'media_ids' => $mediaIds->toArray(),
116117
];
117118
}
118119

tests/TwitterChannelTest.php

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function it_can_send_a_status_update_notification()
4242
$this->twitter->shouldReceive('getLastHttpCode')
4343
->once()
4444
->andReturn(201);
45-
45+
4646
$this->channel->send(new TestNotifiable(), new TestNotification());
4747
}
4848

@@ -60,7 +60,7 @@ public function it_can_send_a_status_update_notification_with_images()
6060
->once()
6161
->with(
6262
'tweets',
63-
['text' => 'Laravel Notification Channels are awesome!', 'media' => [ 'media_ids' => [2]]],
63+
['text' => 'Laravel Notification Channels are awesome!', 'media' => ['media_ids' => [2]]],
6464
true
6565
)
6666
->andReturn([]);
@@ -96,7 +96,7 @@ public function it_can_send_a_status_update_notification_with_videos()
9696
->once()
9797
->with(
9898
'tweets',
99-
['text' => 'Laravel Notification Channels are awesome!', 'media' => [ 'media_ids' => [2]]],
99+
['text' => 'Laravel Notification Channels are awesome!', 'media' => ['media_ids' => [2]]],
100100
true
101101
)
102102
->andReturn([]);
@@ -195,7 +195,7 @@ public function it_throws_an_exception_when_it_could_not_send_the_notification_w
195195
->once()
196196
->with($media->media_id_string)
197197
->andReturn($status);
198-
198+
199199
$this->expectException(CouldNotSendNotification::class);
200200

201201
$this->channel->send(new TestNotifiable(), new TestNotificationWithVideo());
@@ -265,18 +265,11 @@ class TestNotificationWithReplyToStatusId extends Notification
265265
{
266266
private int $replyToStatusId;
267267

268-
/**
269-
* @param int $replyToStatusId
270-
*/
271268
public function __construct(int $replyToStatusId)
272269
{
273270
$this->replyToStatusId = $replyToStatusId;
274271
}
275272

276-
/**
277-
* @param mixed $notifiable
278-
* @return TwitterMessage
279-
*/
280273
public function toTwitter(mixed $notifiable): TwitterMessage
281274
{
282275
return (new TwitterStatusUpdate('Laravel Notification Channels are awesome!'))

tests/TwitterDirectMessageTest.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,9 @@
99
class TwitterDirectMessageTest extends TestCase
1010
{
1111
protected TwitterDirectMessage $messageWithUserId;
12+
1213
protected TwitterDirectMessage $messageWithScreenName;
14+
1315
protected TwitterOAuth $twitter;
1416

1517
public function setUp(): void

tests/TwitterStatusUpdateTest.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,10 @@ public function it_constructs_a_request_body(): void
8787
$message->videoIds = collect([534, 535, 536]);
8888

8989
$this->assertEquals([
90-
'text' => 'myMessage',
90+
'text' => 'myMessage',
9191
'media' => [
92-
'media_ids' => [434,435,436,534,535,536]
93-
]
92+
'media_ids' => [434, 435, 436, 534, 535, 536],
93+
],
9494
], $message->getRequestBody());
9595
}
9696

0 commit comments

Comments
 (0)