From 0a76a3562da07596463f903cc1031539f2da54cc Mon Sep 17 00:00:00 2001 From: Valithor Obsidion Date: Thu, 21 Nov 2024 15:04:24 -0500 Subject: [PATCH] PHP 8.4: Implicitly nullable parameters deprecated --- src/Discord/Helpers/RegisteredCommand.php | 4 ++-- src/Discord/Parts/Channel/Channel.php | 2 +- src/Discord/Repository/Guild/MemberRepository.php | 2 +- tests/functions.php | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Discord/Helpers/RegisteredCommand.php b/src/Discord/Helpers/RegisteredCommand.php index fb780bfd4..2378addfd 100644 --- a/src/Discord/Helpers/RegisteredCommand.php +++ b/src/Discord/Helpers/RegisteredCommand.php @@ -168,14 +168,14 @@ public function getSubCommand(string $name): ?RegisteredCommand * Adds a sub-command to the command. * * @param string|array $name - * @param callable $callback + * @param callable|null $callback * @param callable|null $autocomplete_callback * * @throws \LogicException * * @return static */ - public function addSubCommand($name, callable $callback = null, ?callable $autocomplete_callback = null): RegisteredCommand + public function addSubCommand($name, ?callable $callback = null, ?callable $autocomplete_callback = null): RegisteredCommand { if (is_array($name) && count($name) == 1) { $name = array_shift($name); diff --git a/src/Discord/Parts/Channel/Channel.php b/src/Discord/Parts/Channel/Channel.php index 92110c1de..507db9a41 100644 --- a/src/Discord/Parts/Channel/Channel.php +++ b/src/Discord/Parts/Channel/Channel.php @@ -982,7 +982,7 @@ protected function getDefaultReactionEmojiAttribute(): ?Reaction * * @since 10.0.0 Arguments for `$name`, `$private` and `$auto_archive_duration` are now inside `$options` */ - public function startThread(array|string $options, string|null|bool $reason = null, int $_auto_archive_duration = 1440, ?string $_reason = null): PromiseInterface + public function startThread(array|string $options, string|bool|null $reason = null, int $_auto_archive_duration = 1440, ?string $_reason = null): PromiseInterface { // Old v7 signature if (is_string($options)) { diff --git a/src/Discord/Repository/Guild/MemberRepository.php b/src/Discord/Repository/Guild/MemberRepository.php index 2bc7966d3..85d2435b6 100755 --- a/src/Discord/Repository/Guild/MemberRepository.php +++ b/src/Discord/Repository/Guild/MemberRepository.php @@ -68,7 +68,7 @@ public function kick(Member $member, ?string $reason = null): PromiseInterface * * @param array $queryparams Query string params to add to the request, leave null to paginate all members (Warning: Be careful to use this on very large guild) */ - public function freshen(array $queryparams = null): PromiseInterface + public function freshen(?array $queryparams = null): PromiseInterface { if (isset($queryparams)) { return parent::freshen($queryparams); diff --git a/tests/functions.php b/tests/functions.php index 963c8272d..0d858e8a3 100644 --- a/tests/functions.php +++ b/tests/functions.php @@ -16,7 +16,7 @@ const TIMEOUT = 10; -function wait(callable $callback, float $timeout = TIMEOUT, callable $timeoutFn = null) +function wait(callable $callback, float $timeout = TIMEOUT, ?callable $timeoutFn = null) { $discord = DiscordSingleton::get();