Skip to content

Commit f019884

Browse files
committed
fix: laravel 9, make default name static
1 parent 5a7fb1e commit f019884

File tree

2 files changed

+17
-30
lines changed

2 files changed

+17
-30
lines changed

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,16 @@
3232
}
3333
],
3434
"require": {
35-
"php": ">=7.0",
36-
"illuminate/events": "~5.5 || ~6.0 || ~7.0 || ~8.0",
37-
"illuminate/notifications": "~5.5 || ~6.0 || ~7.0 || ~8.0",
38-
"illuminate/queue": "~5.5 || ~6.0 || ~7.0 || ~8.0",
39-
"illuminate/support": "~5.5 || ~6.0 || ~7.0 || ~8.0",
35+
"php": ">=7.4",
36+
"illuminate/events": "~7.0 || ~8.0 || ~9.0",
37+
"illuminate/notifications": "~7.0 || ~8.0 || ~9.0",
38+
"illuminate/queue": "~7.0 || ~8.0 || ~9.0",
39+
"illuminate/support": "~7.0 || ~8.0 || ~9.0",
4040
"pusher/pusher-push-notifications": "^1.1"
4141
},
4242
"require-dev": {
4343
"mockery/mockery": "^1.3",
44-
"phpunit/phpunit": "^8.5"
44+
"phpunit/phpunit": "^9.5"
4545
},
4646
"autoload": {
4747
"psr-4": {

src/PusherChannel.php

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
declare(strict_types=1);
4+
35
namespace NotificationChannels\PusherPushNotifications;
46

57
use Illuminate\Contracts\Events\Dispatcher;
@@ -12,25 +14,12 @@
1214

1315
class PusherChannel
1416
{
15-
/**
16-
* @var string
17-
*/
18-
const INTERESTS = 'interests';
17+
public const INTERESTS = 'interests';
1918

20-
/**
21-
* @var PushNotifications
22-
*/
23-
protected $beamsClient;
19+
protected PushNotifications $beamsClient;
2420

25-
/**
26-
* @var \Illuminate\Contracts\Events\Dispatcher
27-
*/
28-
private $events;
21+
private Dispatcher $events;
2922

30-
/**
31-
* @param PushNotifications $beamsClient
32-
* @param Dispatcher $events
33-
*/
3423
public function __construct(PushNotifications $beamsClient, Dispatcher $events)
3524
{
3625
$this->beamsClient = $beamsClient;
@@ -40,17 +29,16 @@ public function __construct(PushNotifications $beamsClient, Dispatcher $events)
4029
/**
4130
* Send the given notification.
4231
*
43-
* @param mixed $notifiable
44-
* @param \Illuminate\Notifications\Notification $notification
45-
*
32+
* @param mixed $notifiable
33+
* @param Notification $notification
4634
* @return void
4735
*/
48-
public function send($notifiable, Notification $notification)
36+
public function send($notifiable, Notification $notification): void
4937
{
5038
$type = $notifiable->pushNotificationType ?? self::INTERESTS;
5139

5240
$data = $notifiable->routeNotificationFor('PusherPushNotifications')
53-
?: $this->defaultName($notifiable);
41+
?: self::defaultName($notifiable);
5442

5543
try {
5644
$notificationType = sprintf('publishTo%s', Str::ucfirst($type));
@@ -69,11 +57,10 @@ public function send($notifiable, Notification $notification)
6957
/**
7058
* Get the default name for the notifiable.
7159
*
72-
* @param $notifiable
73-
*
60+
* @param mixed $notifiable
7461
* @return string
7562
*/
76-
protected function defaultName($notifiable)
63+
public static function defaultName($notifiable): string
7764
{
7865
$class = str_replace('\\', '.', get_class($notifiable));
7966

0 commit comments

Comments
 (0)