1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 10:38:59 +01:00

Run composer cs-fix

This commit is contained in:
Mahdi 2023-09-01 17:05:20 +00:00
parent e0056ec4e4
commit f18576dcd0
5 changed files with 28 additions and 41 deletions

View File

@ -18,7 +18,6 @@ namespace danog\MadelineProto\EventHandler;
use Amp\ByteStream\ReadableStream; use Amp\ByteStream\ReadableStream;
use danog\MadelineProto\Ipc\IpcCapable; use danog\MadelineProto\Ipc\IpcCapable;
use danog\MadelineProto\Magic;
use danog\MadelineProto\MTProto; use danog\MadelineProto\MTProto;
use JsonSerializable; 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 ? return $downloadToDir ?
$this->getClient()->downloadToDir($this, $path) : $this->getClient()->downloadToDir($this, $path) :
$this->getClient()->downloadToFile($this, $path); $this->getClient()->downloadToFile($this, $path);

View File

@ -33,7 +33,6 @@ use danog\MadelineProto\EventHandler\Message\Entities\MessageEntity;
use danog\MadelineProto\EventHandler\Message\ReportReason; use danog\MadelineProto\EventHandler\Message\ReportReason;
use danog\MadelineProto\MTProto; use danog\MadelineProto\MTProto;
use danog\MadelineProto\ParseMode; use danog\MadelineProto\ParseMode;
use danog\MadelineProto\ResponseException;
use danog\MadelineProto\StrTools; use danog\MadelineProto\StrTools;
/** /**
@ -223,8 +222,6 @@ abstract class Message extends AbstractMessage
return $this->getClient()->wrapUpdate($result); return $this->getClient()->wrapUpdate($result);
} }
/** /**
* Get our reactions on the message. * Get our reactions on the message.
* *
@ -236,10 +233,8 @@ abstract class Message extends AbstractMessage
} }
/** /**
* Report a message in a chat for violation of telegrams Terms of Service * Report a message in a chat for violation of telegrams Terms of Service.
* *
* @param ReportReason $reason
* @param string $message
*/ */
public function report(ReportReason $reason, string $message): void 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 $firstName First name
* @param string|null $lastName Last name * @param string|null $lastName Last name
@ -267,8 +262,7 @@ abstract class Message extends AbstractMessage
?string $lastName = null, ?string $lastName = null,
?string $phoneNumber = null, ?string $phoneNumber = null,
bool $addPhonePrivacyException = false bool $addPhonePrivacyException = false
): ?Update ): ?Update {
{
return $this->getClient()->wrapUpdate($this->getClient()->extractUpdates($this->getClient()->methodCallAsyncRead( return $this->getClient()->wrapUpdate($this->getClient()->extractUpdates($this->getClient()->methodCallAsyncRead(
'contacts.addContact', '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 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 * @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( return $this->getClient()->wrapUpdate($this->getClient()->extractUpdates($this->getClient()->methodCallAsyncRead(
'channels.inviteToChannel', 'channels.inviteToChannel',
[ [
'channel' => $channel, 'channel' => $channel,
'users' => [$this->senderId] '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( return $this->getClient()->methodCallAsyncRead(
API::isSupergroupOrChannel($this->chatId) ? 'channels.readHistory':'messages.readHistory', API::isSupergroupOrChannel($this->chatId) ? 'channels.readHistory':'messages.readHistory',

View File

@ -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( $this->getClient()->methodCallAsyncRead(
'messages.getMessagesViews', 'messages.getMessagesViews',

View File

@ -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). * @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 = [
'_' => '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). * @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 = [
'_' => '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 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( return $this->getClient()->wrapUpdate($this->getClient()->extractUpdates($this->getClient()->methodCallAsyncRead(
'channels.deleteHistory', 'channels.deleteHistory',
@ -169,5 +167,4 @@ final class GroupMessage extends Message
] ]
))); )));
} }
} }

View File

@ -1,4 +1,4 @@
<?php <?php declare(strict_types=1);
namespace danog\MadelineProto\EventHandler\Message; namespace danog\MadelineProto\EventHandler\Message;