- Remove nullsafe operator from location property

- Fix user serialization in TransactionPartnerUser
 - Remove null check for stickers in StickerSet
 - Fix nullable operator usage in ShippingQuery toArray method
 - Remove null-safe operator for traveler and watcher
 - Fix null-safe operator in PreCheckoutQuery.php
 - Fix null safe operator usage in PollAnswer.php
 - Refactor null checks in PassportData methods
 - Remove nullsafe operator from chat property
 - Refactor web_app handling in MenuButtonWebApp class
 - Fix conditional assignment in InputMediaVideo
 - Fix null coalescing and array mapping in InputMediaAudio
 - Fix redundant null coalescing in caption_entities mapping
 - Fix parsing of caption_entities field in InlineQueryResultPhoto
 - Fix potential unnecessary null coalescing in caption_entities
 - Fix redundant null coalescence check in reply_markup assignment
 - Fix redundant null coalescing in array_map calls
 - Refactor: remove unnecessary null coalescing operator
 - Fix conditional check for caption_entities assignment
 - Fix handling of input_message_content array conversion
 - Fix potential null pointer issue in InlineQuery class
 - Remove redundant null check in toArray method
 - Fix redundant null coalesce operator in photo mapping
 - Remove null safe operator for origin
 - Fix redundant null coalescing in array_map calls.
 - Fix optional chaining error in ChosenInlineResult.php
 - Remove null-safe operator in toArray() method
 - Fix null safe operator usage in ChatMemberRestricted
 - Fix null-safe operator usage in ChatMemberOwner.php
 - Fix null safe operator usage in ChatMemberMember.php
 - Fix nullable operator usage in ChatMemberLeft class
 - Fix null-safe operator in ChatMemberBanned serialization.
 - Fix user attribute null coalescing in ChatMemberAdministrator
 - Fix null-safe operator usage in ChatLocation conversion
 - Remove null safe operator in toArray() method
 - Fix nullable operator usage in ChatInviteLink serialization
 - Fix potential null pointer issue in ChatBoostSourcePremium.
 - Remove null safe operator in ChatBoostRemoved toArray method
 - Fix 'from' property serialization in CallbackQuery
 - Fix nullable operator usage on chat property
 - Remove redundant type check for associative array
 - Remove deprecated BotOld.php file
This commit is contained in:
netkas 2024-11-03 18:07:06 -05:00
parent 7b16b2bbc6
commit 32d8e233b8
42 changed files with 59 additions and 2853 deletions

View file

@ -426,7 +426,7 @@
$parameters = [];
// If arguments are provided as an associative array (named arguments)
if (is_array($arguments) && array_keys($arguments) !== range(0, count($arguments) - 1))
if (array_keys($arguments) !== range(0, count($arguments) - 1))
{
$parameters = $arguments;
}

File diff suppressed because it is too large Load diff

View file

@ -52,7 +52,7 @@
{
return [
'business_connection_id' => $this->business_connection_id,
'chat' => $this->chat?->toArray(),
'chat' => $this->chat->toArray(),
'message_ids' => $this->message_ids
];
}

View file

@ -97,7 +97,7 @@
{
return [
'id' => $this->id,
'from' => $this->from?->toArray(),
'from' => $this->from->toArray(),
'message' => $this->message?->toArray(),
'inline_message_id' => $this->inline_message_id,
'chat_instance' => $this->chat_instance,

View file

@ -57,10 +57,10 @@
public function toArray(): array
{
return [
'chat' => $this->chat?->toArray(),
'chat' => $this->chat->toArray(),
'boost_id' => $this->boost_id,
'remove_date' => $this->remove_date,
'source' => $this->source?->toArray(),
'source' => $this->source->toArray(),
];
}

View file

@ -28,7 +28,7 @@
{
return [
'source' => $this->source->value,
'user' => $this->user?->toArray()
'user' => $this->user->toArray()
];
}

View file

@ -139,7 +139,7 @@
{
return [
'invite_link' => $this->invite_link,
'creator' => $this->creator?->toArray(),
'creator' => $this->creator->toArray(),
'creates_join_request' => $this->creates_join_request ?? false,
'is_primary' => $this->is_primary ?? false,
'is_revoked' => $this->is_revoked ?? false,

View file

@ -84,8 +84,8 @@
public function toArray(): array
{
return [
'chat' => $this->chat?->toArray(),
'from' => $this->from?->toArray(),
'chat' => $this->chat->toArray(),
'from' => $this->from->toArray(),
'user_chat_id' => $this->user_chat_id,
'date' => $this->date,
'bio' => $this->bio,

View file

@ -36,7 +36,7 @@
public function toArray(): array
{
return [
'location' => $this->location?->toArray(),
'location' => $this->location->toArray(),
'address' => $this->address,
];
}

View file

@ -189,7 +189,7 @@
{
return [
'status' => $this->status->value,
'user' => $this->user?->toArray(),
'user' => $this->user->toArray(),
'can_be_edited' => $this->can_be_edited,
'is_anonymous' => $this->is_anonymous,
'can_manage_chat' => $this->can_manage_chat,

View file

@ -40,7 +40,7 @@
{
return [
'status' => $this->status->value,
'user' => $this->user?->toArray(),
'user' => $this->user->toArray(),
'until_date' => $this->until_date
];
}

View file

@ -29,7 +29,7 @@
{
return [
'status' => $this->status->value,
'user' => $this->user?->toArray()
'user' => $this->user->toArray()
];
}

View file

@ -29,7 +29,7 @@
{
return [
'status' => $this->status->value,
'user' => $this->user?->toArray()
'user' => $this->user->toArray()
];
}

View file

@ -51,7 +51,7 @@
{
return [
'status' => $this->status->value,
'user' => $this->user?->toArray(),
'user' => $this->user->toArray(),
'is_anonymous' => $this->is_anonymous,
'custom_title' => $this->custom_title
];

View file

@ -205,7 +205,7 @@
{
return [
'status' => $this->status->value,
'user' => $this->user?->toArray(),
'user' => $this->user->toArray(),
'is_member' => $this->is_member,
'can_send_messages' => $this->can_send_messages,
'can_send_audios' => $this->can_send_audios,

View file

@ -92,11 +92,11 @@
public function toArray(): array
{
return [
'chat' => $this->chat?->toArray(),
'from' => $this->from?->toArray(),
'chat' => $this->chat->toArray(),
'from' => $this->from->toArray(),
'date' => $this->date,
'old_chat_member' => $this->old_chat_member?->toArray(),
'new_chat_member' => $this->new_chat_member?->toArray(),
'old_chat_member' => $this->old_chat_member->toArray(),
'new_chat_member' => $this->new_chat_member->toArray(),
'invite_link' => $this->invite_link?->toArray(),
'via_chat_folder_invite_link' => $this->via_chat_folder_invite_link,
];

View file

@ -286,7 +286,7 @@ class ExternalReplyInfo implements ObjectTypeInterface
public function toArray(): array
{
return [
'origin' => $this->origin?->toArray(),
'origin' => $this->origin->toArray(),
'chat' => $this->chat?->toArray(),
'message_id' => $this->message_id,
'link_preview_options' => $this->link_preview_options?->toArray(),

View file

@ -116,7 +116,7 @@
$object = new self();
$object->description = $data['description'] ?? null;
$object->title = $data['title'] ?? null;
$object->photo = isset($data['photo']) ? array_map(fn(array $items) => PhotoSize::fromArray($items), $data['photo'] ?? []) : null;
$object->photo = isset($data['photo']) ? array_map(fn(array $items) => PhotoSize::fromArray($items), $data['photo']) : null;
$object->text = $data['text'] ?? null;
$object->text_entities = ($data['text_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['text_entities']) : null;
$object->animation = isset($data['animation']) ? Animation::fromArray($data['animation']) : null;

View file

@ -121,7 +121,7 @@ class Giveaway implements ObjectTypeInterface
public function toArray(): array
{
return [
'chats' => is_null($this->chats) ? null : array_map(fn(Chat $chat) => $chat->toArray(), $this->chats),
'chats' => array_map(fn(Chat $chat) => $chat->toArray(), $this->chats),
'winners_selection_date' => $this->winners_selection_date,
'winner_count' => $this->winner_count,
'only_new_members' => $this->only_new_members,

View file

@ -76,7 +76,7 @@
{
return [
'result_id' => $this->result_id,
'from' => $this->from?->toArray(),
'from' => $this->from->toArray(),
'location' => $this->location?->toArray(),
'inline_message_id' => $this->inline_message_id,
'query' => $this->query,

View file

@ -87,7 +87,7 @@
{
return [
'id' => $this->id,
'from' => $this->from?->toArray(),
'from' => $this->from->toArray(),
'query' => $this->query,
'offset' => $this->offset,
'chat_type' => $this->chat_type?->value,

View file

@ -248,7 +248,7 @@
'type' => $this->type->value,
'id' => $this->id,
'title' => $this->title,
'input_message_content' => $this->input_message_content?->toArray(),
'input_message_content' => $this->input_message_content->toArray(),
'reply_markup' => $this->reply_markup?->toArray(),
'url' => $this->url,
'hide_url' => $this->hide_url,
@ -273,7 +273,7 @@
$object->type = InlineQueryResultType::ARTICLE;
$object->id = $data['id'] ?? null;
$object->title = $data['title'] ?? null;
$object->input_message_content = isset($data['input_message_content']) ? InputMessageContent::fromArray($data['input_message_content'] ?? null) : null;
$object->input_message_content = isset($data['input_message_content']) ? InputMessageContent::fromArray($data['input_message_content']) : null;
$object->reply_markup = isset($data['reply_markup']) ? InlineKeyboardMarkup::fromArray($data['reply_markup']) : null;
$object->url = $data['url'] ?? null;
$object->hide_url = $data['hide_url'] ?? null;

View file

@ -326,7 +326,7 @@
$object->title = $data['title'] ?? null;
$object->caption = $data['caption'] ?? null;
$object->parse_mode = $data['parse_mode'] ?? null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities'] ?? []) : null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities']) : null;
$object->performer = $data['performer'] ?? null;
$object->audio_duration = $data['audio_duration'] ?? null;
$object->reply_markup = ($data['reply_markup']) ? InlineKeyboardMarkup::fromArray($data['reply_markup']) : null;

View file

@ -393,12 +393,12 @@
$object->title = $data['title'] ?? null;
$object->caption = $data['caption'] ?? null;
$object->parse_mode = $data['parse_mode'] ?? null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities'] ?? []) : null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities']) : null;
$object->document_url = $data['document_url'] ?? null;
$object->mime_type = $data['mime_type'] ?? null;
$object->description = $data['description'] ?? null;
$object->reply_markup = isset($data['reply_markup']) ? InlineKeyboardMarkup::fromArray($data['reply_markup']) : null;
$object->input_message_content = isset($data['input_message_content']) ? InputVenueMessageContent::fromArray($data['input_message_content'] ?? []) : null;
$object->input_message_content = isset($data['input_message_content']) ? InputVenueMessageContent::fromArray($data['input_message_content']) : null;
$object->thumbnail_url = $data['thumbnail_url'] ?? null;
$object->thumbnail_width = $data['thumbnail_width'] ?? null;
$object->thumbnail_height = $data['thumbnail_height'] ?? null;

View file

@ -408,8 +408,8 @@
$object->title = $data['title'] ?? null;
$object->caption = $data['caption'] ?? null;
$object->parse_mode = $data['parse_mode'] ?? null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities'] ?? []) : null;
$object->reply_markup = isset($data['reply_markup']) ? array_map(fn(array $items) => InlineKeyboardMarkup::fromArray($items), $data['reply_markup'] ?? []) : null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities']) : null;
$object->reply_markup = isset($data['reply_markup']) ? array_map(fn(array $items) => InlineKeyboardMarkup::fromArray($items), $data['reply_markup']) : null;
$object->input_message_content = isset($data['input_message_content']) ? InputMessageContent::fromArray($data['input_message_content']) : null;
return $object;

View file

@ -356,7 +356,7 @@
$object->live_period = $data['live_period'] ?? null;
$object->heading = $data['heading'] ?? null;
$object->proximity_alert_radius = $data['proximity_alert_radius'] ?? null;
$object->reply_markup = isset($data['reply_markup']) ? InlineKeyboardMarkup::fromArray($data['reply_markup'] ?? []) : null;
$object->reply_markup = isset($data['reply_markup']) ? InlineKeyboardMarkup::fromArray($data['reply_markup']) : null;
$object->input_message_content = isset($data['input_message_content']) ? InputMessageContent::fromArray($data['input_message_content']) : null;
$object->thumbnail_url = $data['thumbnail_url'] ?? null;
$object->thumbnail_width = $data['thumbnail_width'] ?? null;

View file

@ -340,7 +340,7 @@
$object->title = $data['title'] ?? null;
$object->caption = $data['caption'] ?? null;
$object->parse_mode = $data['parse_mode'] ?? null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities'] ?? []) : null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities']) : null;
$object->reply_markup = ($data['reply_markup'] ?? null) ? InlineKeyboardMarkup::fromArray($data['reply_markup']) : null;
$object->input_message_content = ($data['input_message_content'] ?? null) ? InputVenueMessageContent::fromArray($data['input_message_content']) : null;

View file

@ -320,7 +320,7 @@
$object->description = $data['description'] ?? null;
$object->caption = $data['caption'] ?? null;
$object->parse_mode = $data['parse_mode'] ?? null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities'] ?? []) : null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities']) : null;
$object->reply_markup = ($data['reply_markup'] !== null) ? InlineKeyboardMarkup::fromArray($data['reply_markup']) : null;
$object->input_message_content = $data['input_message_content'] ?? null;

View file

@ -371,7 +371,7 @@
$object->title = $data['title'] ?? null;
$object->caption = $data['caption'] ?? null;
$object->parse_mode = $data['parse_mode'] ?? null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities'] ?? []) : null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities']) : null;
$object->video_width = $data['video_width'] ?? null;
$object->video_height = $data['video_height'] ?? null;
$object->video_duration = $data['video_duration'] ?? null;

View file

@ -234,7 +234,7 @@
public function toArray(): array
{
$array = [
'type' => $this->type?->value,
'type' => $this->type->value,
'media' => $this->media,
];
@ -292,7 +292,7 @@
$object->thumb = $data['thumb'] ?? null;
$object->caption = $data['caption'] ?? null;
$object->parse_mode = isset($data['parse_mode']) ? ParseMode::tryFrom($data['parse_mode']) ?? null : null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities'] ?? []) : null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities']) : null;
$object->duration = $data['duration'] ?? null;
$object->performer = $data['performer'] ?? null;
$object->title = $data['title'] ?? null;

View file

@ -335,7 +335,7 @@
$object->thumb = $data['thumb'] ?? null;
$object->caption = $data['caption'] ?? null;
$object->parse_mode = $data['parse_mode'] ?? null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities'] ?? []) : null;
$object->caption_entities = isset($data['caption_entities']) ? array_map(fn(array $items) => MessageEntity::fromArray($items), $data['caption_entities']) : null;
$object->width = $data['width'] ?? null;
$object->height = $data['height'] ?? null;
$object->duration = $data['duration'] ?? null;

View file

@ -42,7 +42,7 @@
return [
'type' => $this->type->value,
'text' => $this->text,
'web_app' => $this->web_app?->toArray()
'web_app' => $this->web_app->toArray()
];
}
@ -54,7 +54,7 @@
$object = new self();
$object->type = $data['type'] ?? null;
$object->text = $data['text'] ?? null;
$object->web_app = isset($data['web_app']) ? WebAppInfo::fromArray($data['web_app'] ?? []) : null;
$object->web_app = isset($data['web_app']) ? WebAppInfo::fromArray($data['web_app']) : null;
return $object;
}

View file

@ -97,7 +97,7 @@
public function toArray(): ?array
{
return [
'chat' => $this->chat?->toArray(),
'chat' => $this->chat->toArray(),
'message_id' => $this->message_id,
'user' => $this->user?->toArray(),
'actor_chat' => $this->actor_chat?->toArray(),

View file

@ -189,11 +189,11 @@
$object->data = $data['data'] ?? null;
$object->phone_number = $data['phone_number'] ?? null;
$object->email = $data['email'] ?? null;
$object->files = isset($data['files']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['files'] ?? []) : null;
$object->front_side = isset($data['front_side']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['front_side'] ?? []) : null;
$object->reverse_side = isset($data['reverse_side']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['reverse_side'] ?? []) : null;
$object->selfie = isset($data['selfie']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['selfie'] ?? []) : null;
$object->translation = isset($data['translation']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['translation'] ?? []) : null;
$object->files = isset($data['files']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['files']) : null;
$object->front_side = isset($data['front_side']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['front_side']) : null;
$object->reverse_side = isset($data['reverse_side']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['reverse_side']) : null;
$object->selfie = isset($data['selfie']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['selfie']) : null;
$object->translation = isset($data['translation']) ? array_map(fn(array $items) => PassportFile::fromArray($items), $data['translation']) : null;
$object->hash = $data['hash'];
return $object;

View file

@ -39,8 +39,8 @@
public function toArray(): array
{
return [
'data' => is_null($this->data) ? null : array_map(fn(EncryptedPassportElement $item) => $item->toArray(), $this->data),
'credentials' => $this->credentials?->toArray(),
'data' => array_map(fn(EncryptedPassportElement $item) => $item->toArray(), $this->data),
'credentials' => $this->credentials->toArray(),
];
}
@ -55,7 +55,7 @@
}
$object = new self();
$object->data = isset($data['data']) ? array_map(fn(array $items) => EncryptedPassportElement::fromArray($items), $data['data'] ?? []) : null;
$object->data = isset($data['data']) ? array_map(fn(array $items) => EncryptedPassportElement::fromArray($items), $data['data']) : null;
$object->credentials = isset($data['credentials']) ? EncryptedCredentials::fromArray($data['credentials']) : null;
return $object;

View file

@ -96,7 +96,7 @@
{
return [
'id' => $this->id,
'from' => $this->from?->toArray(),
'from' => $this->from->toArray(),
'currency' => $this->currency,
'total_amount' => $this->total_amount,
'invoice_payload' => $this->invoice_payload,

View file

@ -60,9 +60,9 @@
{
return [
'id' => $this->id,
'from' => $this->from?->toArray(),
'from' => $this->from->toArray(),
'invoice_payload' => $this->invoice_payload,
'shipping_address' => $this->shipping_address?->toArray()
'shipping_address' => $this->shipping_address->toArray()
];
}

View file

@ -65,7 +65,7 @@
{
return [
'type' => $this->type->value,
'user' => $this->user?->toArray(),
'user' => $this->user->toArray(),
'invoice_payload' => $this->invoice_payload,
'paid_media' => is_null($this->paid_media) ? null : array_map(fn(PaidMedia $item) => $item->toArray(), $this->paid_media),
'paid_media_payload' => $this->paid_media_payload,

View file

@ -51,7 +51,7 @@
{
return [
'poll_id' => $this->poll_id,
'user' => $this->user?->toArray(),
'user' => $this->user->toArray(),
'option_ids' => $this->option_ids,
];
}

View file

@ -47,8 +47,8 @@
public function toArray(): array
{
return [
'traveler' => $this->traveler?->toArray(),
'watcher' => $this->watcher?->toArray(),
'traveler' => $this->traveler->toArray(),
'watcher' => $this->watcher->toArray(),
'distance' => $this->distance,
];
}

View file

@ -103,7 +103,7 @@
'sticker_type' => $this->sticker_type->value,
'is_animated' => $this->is_animated,
'is_video' => $this->is_video,
'stickers' => is_null($this->stickers) ? null : array_map(fn(Sticker $sticker) => $sticker->toArray(), $this->stickers),
'stickers' => array_map(fn(Sticker $sticker) => $sticker->toArray(), $this->stickers),
'thumbnail' => ($this->thumbnail instanceof PhotoSize) ? $this->thumbnail->toArray() : null,
];
}

View file

@ -92,7 +92,7 @@
public function toArray(): array
{
return [
'location' => $this->location?->toArray(),
'location' => $this->location->toArray(),
'title' => $this->title,
'address' => $this->address,
'foursquare_id' => $this->foursquare_id,