Skip to content

Commit bcff68b

Browse files
committed
fix throw при пустом запросе
1 parent 089fde4 commit bcff68b

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/DataFetcher.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,20 @@ public function getEventId(): string
5353
return $this->event_id;
5454
}
5555

56-
5756
private int $group_id;
5857

5958
private string $event_id;
6059

61-
public function __construct(private object $data)
60+
public function __construct(private ?object $data = null)
6261
{
63-
if ($data->type === 'message_new') {
64-
$this->client_info = $data->object->client_info;
62+
if ($data?->type === 'message_new') {
63+
$this->client_info = $data?->object->client_info;
6564
}
6665

67-
$this->type = $data->type;
66+
$this->type = $data?->type;
6867
$this->raw_data = $data;
69-
$this->group_id = $data->group_id;
70-
$this->event_id = $data->event_id;
68+
$this->group_id = $data?->group_id;
69+
$this->event_id = $data?->event_id;
7170
}
7271

7372
public function messageNew(): MessageNew

0 commit comments

Comments
 (0)