Skip to content

Commit 6a2b55c

Browse files
committed
refactor: webpushmessage implements arrayable
1 parent 69d24f9 commit 6a2b55c

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

src/WebPushMessage.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
namespace NotificationChannels\WebPush;
44

5+
use Illuminate\Contracts\Support\Arrayable;
56
use Illuminate\Support\Arr;
67

78
/**
9+
* @implements \Illuminate\Contracts\Support\Arrayable<string, mixed>
10+
*
811
* @link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerRegistration/showNotification#Parameters
912
*/
10-
class WebPushMessage
13+
class WebPushMessage implements Arrayable
1114
{
1215
protected string $title;
1316

tests/MessageTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@
77

88
class MessageTest extends TestCase
99
{
10-
/** @var \NotificationChannels\WebPush\WebPushMessage */
11-
protected $message;
10+
protected WebPushMessage $message;
1211

1312
protected function setUp(): void
1413
{

tests/TestNotification.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,8 @@ class TestNotification extends Notification
99
{
1010
/**
1111
* Get the web push representation of the notification.
12-
*
13-
* @param mixed $notifiable
14-
* @param mixed $notification
15-
* @return \NotificationChannels\WebPush\WebPushMessage
1612
*/
17-
public function toWebPush($notifiable, $notification)
13+
public function toWebPush(mixed $notifiable, mixed $notification): WebPushMessage
1814
{
1915
return (new WebPushMessage)
2016
->data(['id' => 1])

0 commit comments

Comments
 (0)