Skip to content

Commit b49079a

Browse files
committed
More type and docblock improvements
1 parent 1485a06 commit b49079a

File tree

5 files changed

+13
-35
lines changed

5 files changed

+13
-35
lines changed

src/Exceptions/CouldNotSendNotification.php

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,7 @@
66

77
class CouldNotSendNotification extends Exception
88
{
9-
/**
10-
* @param $response
11-
* @return CouldNotSendNotification
12-
*/
13-
public static function serviceRespondsNotSuccessful($response): CouldNotSendNotification
9+
public static function serviceRespondsNotSuccessful(mixed $response): CouldNotSendNotification
1410
{
1511
if (isset($response->error)) {
1612
return new static("Couldn't post notification. Response: ".$response->error);
@@ -21,11 +17,7 @@ public static function serviceRespondsNotSuccessful($response): CouldNotSendNoti
2117
return new static("Couldn't post notification. Response: ".$responseBody);
2218
}
2319

24-
/**
25-
* @param $response
26-
* @return CouldNotSendNotification
27-
*/
28-
public static function userWasNotFound($response): CouldNotSendNotification
20+
public static function userWasNotFound(mixed $response): CouldNotSendNotification
2921
{
3022
$responseBody = print_r($response->errors[0]->message, true);
3123

src/TwitterDirectMessage.php

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ public function getApiEndpoint(): string
2222
/**
2323
* Get Twitter direct message receiver.
2424
*
25-
* @param TwitterOAuth $twitter
2625
* @return string|mixed
2726
*
2827
* @throws CouldNotSendNotification
@@ -49,9 +48,6 @@ public function getReceiver(TwitterOAuth $twitter): mixed
4948
/**
5049
* Build Twitter request body.
5150
*
52-
* @param TwitterOAuth $twitter
53-
* @return array
54-
*
5551
* @throws CouldNotSendNotification
5652
*/
5753
public function getRequestBody(TwitterOAuth $twitter): array

src/TwitterStatusUpdate.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ public function getApiEndpoint(): string
3131
/**
3232
* Set Twitter media files.
3333
*
34-
* @param array|string $images
3534
* @return $this
3635
*/
3736
public function withImage(array|string $images): static
@@ -47,8 +46,6 @@ public function withImage(array|string $images): static
4746

4847
/**
4948
* Get Twitter images list.
50-
*
51-
* @return array|null
5249
*/
5350
public function getImages(): ?array
5451
{

tests/TwitterChannelTest.php

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace NotificationChannels\Twitter\Test;
44

55
use Abraham\TwitterOAuth\TwitterOAuth;
6+
use Illuminate\Notifications\Notifiable;
67
use Illuminate\Notifications\Notification;
78
use Mockery;
89
use NotificationChannels\Twitter\Exceptions\CouldNotSendNotification;
@@ -13,11 +14,12 @@
1314

1415
class TwitterChannelTest extends TestCase
1516
{
16-
/** @var Mockery\Mock */
17+
/**
18+
* @var Mockery\Mock
19+
*/
1720
protected $twitter;
1821

19-
/** @var \NotificationChannels\Twitter\TwitterChannel */
20-
protected $channel;
22+
protected TwitterChannel $channel;
2123

2224
public function setUp(): void
2325
{
@@ -100,10 +102,10 @@ public function it_throws_an_exception_when_it_could_not_send_the_notification()
100102

101103
class TestNotifiable
102104
{
103-
use \Illuminate\Notifications\Notifiable;
105+
use Notifiable;
104106

105107
/**
106-
* @return int
108+
* @return false
107109
*/
108110
public function routeNotificationForTwitter()
109111
{
@@ -113,9 +115,11 @@ public function routeNotificationForTwitter()
113115

114116
class TestNotifiableWithDifferentSettings
115117
{
116-
use \Illuminate\Notifications\Notifiable;
118+
use Notifiable;
117119

118-
/** @return array */
120+
/**
121+
* @return array
122+
*/
119123
public function routeNotificationForTwitter()
120124
{
121125
return ['1', '2', '3', '4'];

tests/TwitterMessageTest.php

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

33
namespace NotificationChannels\Twitter\Test;
44

5-
use Abraham\TwitterOAuth\TwitterOAuth;
65
use ArgumentCountError;
7-
use Mockery;
8-
use NotificationChannels\Twitter\TwitterDirectMessage;
96
use NotificationChannels\Twitter\TwitterMessage;
107

118
class TwitterMessageTest extends TestCase
129
{
13-
// public function setUp(): void
14-
// {
15-
// parent::setUp();
16-
// $this->twitter = Mockery::mock(TwitterOAuth::class);
17-
// $this->messageWithUserId = new TwitterDirectMessage(1234, 'myMessage');
18-
// $this->messageWithScreenName = new TwitterDirectMessage('receiver', 'myMessage');
19-
// }
20-
2110
/** @test */
2211
public function it_needs_a_content()
2312
{

0 commit comments

Comments
 (0)