Skip to content

Commit a504bcb

Browse files
committed
fix: initialize web push msg properties with null by default
1 parent 45f014d commit a504bcb

2 files changed

Lines changed: 28 additions & 28 deletions

File tree

‎src/DeclarativeWebPushMessage.php‎

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -12,45 +12,45 @@
1212
*/
1313
class DeclarativeWebPushMessage implements WebPushMessageInterface
1414
{
15-
protected string $title;
15+
protected ?string $title = null;
1616

1717
/**
1818
* @var array<array-key, array{'title': string, 'action': string, 'navigate': string, 'icon'?: string}>
1919
*/
2020
protected array $actions = [];
2121

22-
protected string $badge;
22+
protected ?string $badge = null;
2323

24-
protected string $body;
24+
protected ?string $body = null;
2525

26-
protected string $dir;
26+
protected ?string $dir = null;
2727

28-
protected string $icon;
28+
protected ?string $icon = null;
2929

30-
protected string $image;
30+
protected ?string $image = null;
3131

32-
protected string $lang;
32+
protected ?string $lang = null;
3333

34-
protected bool $mutable;
34+
protected ?bool $mutable = null;
3535

36-
protected string $navigate;
36+
protected ?string $navigate = null;
3737

38-
protected bool $renotify;
38+
protected ?bool $renotify = null;
3939

40-
protected bool $requireInteraction;
40+
protected ?bool $requireInteraction = null;
4141

42-
protected bool $silent;
42+
protected ?bool $silent = null;
4343

44-
protected string $tag;
44+
protected ?string $tag = null;
4545

46-
protected int $timestamp;
46+
protected ?int $timestamp = null;
4747

4848
/**
4949
* @var array<int>
5050
*/
51-
protected array $vibrate;
51+
protected array $vibrate = [];
5252

53-
protected mixed $data;
53+
protected mixed $data = null;
5454

5555
/**
5656
* @var array<string, mixed>

‎src/WebPushMessage.php‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -11,37 +11,37 @@
1111
*/
1212
class WebPushMessage implements WebPushMessageInterface
1313
{
14-
protected string $title;
14+
protected ?string $title = null;
1515

1616
/**
1717
* @var array<array-key, array{'title': string, 'action': string, 'icon'?: string}>
1818
*/
1919
protected array $actions = [];
2020

21-
protected string $badge;
21+
protected ?string $badge = null;
2222

23-
protected string $body;
23+
protected ?string $body = null;
2424

25-
protected string $dir;
25+
protected ?string $dir = null;
2626

27-
protected string $icon;
27+
protected ?string $icon = null;
2828

29-
protected string $image;
29+
protected ?string $image = null;
3030

31-
protected string $lang;
31+
protected ?string $lang = null;
3232

33-
protected bool $renotify;
33+
protected ?bool $renotify = null;
3434

35-
protected bool $requireInteraction;
35+
protected ?bool $requireInteraction = null;
3636

37-
protected string $tag;
37+
protected ?string $tag = null;
3838

3939
/**
4040
* @var array<int>
4141
*/
42-
protected array $vibrate;
42+
protected array $vibrate = [];
4343

44-
protected mixed $data;
44+
protected mixed $data = null;
4545

4646
/**
4747
* @var array<string, mixed>

0 commit comments

Comments
 (0)