Skip to content

Commit

Permalink
Merge pull request #673 from ah-rahimi/fix-php8.4
Browse files Browse the repository at this point in the history
fix: Implicitly nullable parameter types in php8.4
  • Loading branch information
fabio-ivona authored Nov 27, 2024
2 parents 927de3b + 7d4e146 commit fd1e464
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 20 deletions.
6 changes: 3 additions & 3 deletions src/Concerns/ComposesMessages.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ private function setMessageText(string $message): void
$this->data['chat_id'] = $this->getChatId();
}

public function html(string $message = null): Telegraph
public function html(?string $message = null): Telegraph
{
$telegraph = clone $this;

Expand All @@ -41,7 +41,7 @@ public function html(string $message = null): Telegraph
return $telegraph;
}

public function markdown(string $message = null): Telegraph
public function markdown(?string $message = null): Telegraph
{
$telegraph = clone $this;

Expand All @@ -54,7 +54,7 @@ public function markdown(string $message = null): Telegraph
return $telegraph;
}

public function markdownV2(string $message = null): Telegraph
public function markdownV2(?string $message = null): Telegraph
{
$telegraph = clone $this;

Expand Down
12 changes: 6 additions & 6 deletions src/Concerns/HasBotsAndChats.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function leaveChat(): Telegraph
return $telegraph;
}

public function createForumTopic(string $name, int $iconColor = null, string $iconCustomEmojiId = null): Telegraph
public function createForumTopic(string $name, ?int $iconColor = null, ?string $iconCustomEmojiId = null): Telegraph
{
$telegraph = clone $this;
$telegraph->endpoint = self::ENDPOINT_CREATE_FORUM_TOPIC;
Expand All @@ -146,7 +146,7 @@ public function createForumTopic(string $name, int $iconColor = null, string $ic
return $telegraph;
}

public function editForumTopic(int $threadId = null, string $name = null, string $iconCustomEmojiId = null): Telegraph
public function editForumTopic(?int $threadId = null, ?string $name = null, ?string $iconCustomEmojiId = null): Telegraph
{
$telegraph = clone $this;

Expand All @@ -172,7 +172,7 @@ public function editForumTopic(int $threadId = null, string $name = null, string
return $telegraph;
}

public function closeForumTopic(int $threadId = null): Telegraph
public function closeForumTopic(?int $threadId = null): Telegraph
{
$telegraph = clone $this;

Expand All @@ -189,7 +189,7 @@ public function closeForumTopic(int $threadId = null): Telegraph
return $telegraph;
}

public function reopenForumTopic(int $threadId = null): Telegraph
public function reopenForumTopic(?int $threadId = null): Telegraph
{
$telegraph = clone $this;

Expand All @@ -206,7 +206,7 @@ public function reopenForumTopic(int $threadId = null): Telegraph
return $telegraph;
}

public function deleteForumTopic(int $threadId = null): Telegraph
public function deleteForumTopic(?int $threadId = null): Telegraph
{
$telegraph = clone $this;

Expand Down Expand Up @@ -235,7 +235,7 @@ public function botInfo(): Telegraph
/**
* @param string[]|null $allowedUpdates
*/
public function botUpdates(int $timeout = null, int $offset = null, int $limit = null, array $allowedUpdates = null): Telegraph
public function botUpdates(?int $timeout = null, ?int $offset = null, ?int $limit = null, ?array $allowedUpdates = null): Telegraph
{
$telegraph = clone $this;

Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/InteractsWithTelegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ protected function prepareData(): array
return $data;
}

protected function dispatchRequestToTelegram(string $queue = null): PendingDispatch
protected function dispatchRequestToTelegram(?string $queue = null): PendingDispatch
{
return SendRequestToTelegramJob::dispatch($this->getApiUrl(), $this->prepareData(), $this->files)->onQueue($queue);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/InteractsWithWebhooks.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ private function getWebhookUrl(): string
* @throws \DefStudio\Telegraph\Exceptions\TelegramWebhookException
* @return \DefStudio\Telegraph\Telegraph
*/
public function registerWebhook(bool $dropPendingUpdates = null, int $maxConnections = null, string $secretToken = null, array $allowedUpdates = null): Telegraph
public function registerWebhook(?bool $dropPendingUpdates = null, ?int $maxConnections = null, ?string $secretToken = null, ?array $allowedUpdates = null): Telegraph
{
$telegraph = clone $this;

Expand Down
16 changes: 8 additions & 8 deletions src/Concerns/SendsAttachments.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function contact(string $phoneNumber, string $firstName): self
return $telegraph;
}

public function voice(string $path, string $filename = null): self
public function voice(string $path, ?string $filename = null): self
{
$telegraph = clone $this;

Expand All @@ -111,7 +111,7 @@ public function voice(string $path, string $filename = null): self
return $telegraph;
}

public function animation(string $path, string $filename = null): self
public function animation(string $path, ?string $filename = null): self
{
$telegraph = clone $this;

Expand All @@ -125,7 +125,7 @@ public function animation(string $path, string $filename = null): self
return $telegraph;
}

public function video(string $path, string $filename = null): self
public function video(string $path, ?string $filename = null): self
{
$telegraph = clone $this;

Expand All @@ -139,7 +139,7 @@ public function video(string $path, string $filename = null): self
return $telegraph;
}

public function audio(string $path, string $filename = null): self
public function audio(string $path, ?string $filename = null): self
{
$telegraph = clone $this;

Expand All @@ -153,7 +153,7 @@ public function audio(string $path, string $filename = null): self
return $telegraph;
}

public function document(string $path, string $filename = null): self
public function document(string $path, ?string $filename = null): self
{
$telegraph = clone $this;

Expand Down Expand Up @@ -223,7 +223,7 @@ public function thumbnail(string $path): self
return $telegraph;
}

public function photo(string $path, string $filename = null): self
public function photo(string $path, ?string $filename = null): self
{
$telegraph = clone $this;

Expand Down Expand Up @@ -291,7 +291,7 @@ private function fileSizeInKb(string $path): float
return ceil($sizeInKBytes * 100) / 100;
}

public function dice(string $emoji = null): self
public function dice(?string $emoji = null): self
{
$telegraph = clone $this;

Expand All @@ -305,7 +305,7 @@ public function dice(string $emoji = null): self
return $telegraph;
}

public function sticker(string $path, string $filename = null): self
public function sticker(string $path, ?string $filename = null): self
{
$telegraph = clone $this;

Expand Down
2 changes: 1 addition & 1 deletion src/Concerns/StoresFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public function getFileInfo(string $fileId): Telegraph
return $telegraph;
}

public function store(Downloadable|string $downloadable, string $path, string $filename = null): string
public function store(Downloadable|string $downloadable, string $path, ?string $filename = null): string
{
$fileId = is_string($downloadable) ? $downloadable : $downloadable->id();

Expand Down

0 comments on commit fd1e464

Please sign in to comment.