Skip to content

Commit c5c2abb

Browse files
committed
Return ChatMemberNotImplemented if status is missing from data
1 parent b6aae4a commit c5c2abb

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/Entities/ChatMember/Factory.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,6 @@ class Factory extends \Longman\TelegramBot\Entities\Factory
1111
{
1212
public function make(array $data, string $bot_username): Entity
1313
{
14-
if (! isset($data['status'])) {
15-
throw new TelegramException('Missing ChatMember status');
16-
}
17-
1814
$type = [
1915
'creator' => ChatMemberOwner::class,
2016
'administrator' => ChatMemberAdministrator::class,
@@ -24,7 +20,7 @@ public function make(array $data, string $bot_username): Entity
2420
'kicked' => ChatMemberBanned::class,
2521
];
2622

27-
if (! isset($type[$data['status']])) {
23+
if (! isset($type[$data['status'] ?? ''])) {
2824
return new ChatMemberNotImplemented($data, $bot_username);
2925
}
3026

0 commit comments

Comments
 (0)