diff --git a/src/EventHandler/Media.php b/src/EventHandler/Media.php index 090b6d2a5..ba495019c 100644 --- a/src/EventHandler/Media.php +++ b/src/EventHandler/Media.php @@ -18,7 +18,6 @@ namespace danog\MadelineProto\EventHandler; use Amp\ByteStream\ReadableStream; use danog\MadelineProto\Ipc\IpcCapable; -use danog\MadelineProto\Magic; use danog\MadelineProto\MTProto; use JsonSerializable; @@ -121,14 +120,12 @@ abstract class Media extends IpcCapable implements JsonSerializable } /** - * Download the media to working directory or passed path + * Download the media to working directory or passed path. * - * @param string|null $path - * @param bool $downloadToDir */ - public function download(?string $path = null,bool $downloadToDir = true): string + public function download(?string $path = null, bool $downloadToDir = true): string { - $path ??= getcwd(); + $path ??= \getcwd(); return $downloadToDir ? $this->getClient()->downloadToDir($this, $path) : $this->getClient()->downloadToFile($this, $path); diff --git a/src/EventHandler/Message.php b/src/EventHandler/Message.php index cd484e881..c016a6c74 100644 --- a/src/EventHandler/Message.php +++ b/src/EventHandler/Message.php @@ -33,7 +33,6 @@ use danog\MadelineProto\EventHandler\Message\Entities\MessageEntity; use danog\MadelineProto\EventHandler\Message\ReportReason; use danog\MadelineProto\MTProto; use danog\MadelineProto\ParseMode; -use danog\MadelineProto\ResponseException; use danog\MadelineProto\StrTools; /** @@ -223,8 +222,6 @@ abstract class Message extends AbstractMessage return $this->getClient()->wrapUpdate($result); } - - /** * Get our reactions on the message. * @@ -236,10 +233,8 @@ abstract class Message extends AbstractMessage } /** - * Report a message in a chat for violation of telegram’s Terms of Service + * Report a message in a chat for violation of telegram’s Terms of Service. * - * @param ReportReason $reason - * @param string $message */ public function report(ReportReason $reason, string $message): void { @@ -255,7 +250,7 @@ abstract class Message extends AbstractMessage } /** - * Save message sender to your account contacts + * Save message sender to your account contacts. * * @param string $firstName First name * @param string|null $lastName Last name @@ -267,8 +262,7 @@ abstract class Message extends AbstractMessage ?string $lastName = null, ?string $phoneNumber = null, bool $addPhonePrivacyException = false - ): ?Update - { + ): ?Update { return $this->getClient()->wrapUpdate($this->getClient()->extractUpdates($this->getClient()->methodCallAsyncRead( 'contacts.addContact', [ @@ -282,7 +276,7 @@ abstract class Message extends AbstractMessage } /** - * Remove message sender from your account contacts + * Remove message sender from your account contacts. */ public function removeContact(): ?Update { @@ -295,19 +289,19 @@ abstract class Message extends AbstractMessage } /** - * Invite message sender to requested channel + * Invite message sender to requested channel. * * @param string|int $channel Username, chat ID, Update, Message or InputChannel */ - public function inviteToChannel(string|int $channel) :?Update + public function inviteToChannel(string|int $channel): ?Update { - return $this->getClient()->wrapUpdate($this->getClient()->extractUpdates($this->getClient()->methodCallAsyncRead( - 'channels.inviteToChannel', - [ - 'channel' => $channel, - 'users' => [$this->senderId] - ] - ))); + return $this->getClient()->wrapUpdate($this->getClient()->extractUpdates($this->getClient()->methodCallAsyncRead( + 'channels.inviteToChannel', + [ + 'channel' => $channel, + 'users' => [$this->senderId] + ] + ))); } /** @@ -392,11 +386,10 @@ abstract class Message extends AbstractMessage } /** - * Mark selected message as read pass 0 to $maxId parameter to read all messages in current chat + * Mark selected message as read pass 0 to $maxId parameter to read all messages in current chat. * - * @param int|null $maxId */ - public function read(?int $maxId = null) : bool + public function read(?int $maxId = null): bool { return $this->getClient()->methodCallAsyncRead( API::isSupergroupOrChannel($this->chatId) ? 'channels.readHistory':'messages.readHistory', diff --git a/src/EventHandler/Message/ChannelMessage.php b/src/EventHandler/Message/ChannelMessage.php index d62cd3c70..9a165d17d 100644 --- a/src/EventHandler/Message/ChannelMessage.php +++ b/src/EventHandler/Message/ChannelMessage.php @@ -98,9 +98,9 @@ final class ChannelMessage extends Message } /** - * Increase the view counter of a current message in the channel + * Increase the view counter of a current message in the channel. */ - public function view() :void + public function view(): void { $this->getClient()->methodCallAsyncRead( 'messages.getMessagesViews', diff --git a/src/EventHandler/Message/GroupMessage.php b/src/EventHandler/Message/GroupMessage.php index b55d50ef3..ff78e61e7 100644 --- a/src/EventHandler/Message/GroupMessage.php +++ b/src/EventHandler/Message/GroupMessage.php @@ -62,11 +62,11 @@ final class GroupMessage extends Message } /** - * Ban message sender from current supergroup + * Ban message sender from current supergroup. * * @param int $untilDate Validity of said permissions (it is considered forever any value less then 30 seconds or more then 366 days). */ - public function ban(int $untilDate = 0) :?Update + public function ban(int $untilDate = 0): ?Update { $chatBannedRights = [ '_' => 'chatBannedRights', @@ -103,11 +103,11 @@ final class GroupMessage extends Message } /** - * Unban message sender from current supergroup + * Unban message sender from current supergroup. * * @param int $untilDate Validity of said permissions (it is considered forever any value less then 30 seconds or more then 366 days). */ - public function unban(int $untilDate = 0) :?Update + public function unban(int $untilDate = 0): ?Update { $chatBannedRights = [ '_' => 'chatBannedRights', @@ -144,7 +144,7 @@ final class GroupMessage extends Message } /** - * Kick message sender from current supergroup + * Kick message sender from current supergroup. */ public function kick(): void { @@ -153,12 +153,10 @@ final class GroupMessage extends Message } /** - * Revoke all supergroup message + * Revoke all supergroup message. * - * @param bool $forEveryone - * @param int $maxId */ - public function revokeAll(bool $forEveryone = true,int $maxId = 0) :Update + public function revokeAll(bool $forEveryone = true, int $maxId = 0): Update { return $this->getClient()->wrapUpdate($this->getClient()->extractUpdates($this->getClient()->methodCallAsyncRead( 'channels.deleteHistory', @@ -169,5 +167,4 @@ final class GroupMessage extends Message ] ))); } - } diff --git a/src/EventHandler/Message/ReportReason.php b/src/EventHandler/Message/ReportReason.php index 5a9fff5f9..67ad5ee1b 100644 --- a/src/EventHandler/Message/ReportReason.php +++ b/src/EventHandler/Message/ReportReason.php @@ -1,4 +1,4 @@ -