Skip to content

Commit

Permalink
Indent phpdocs
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Sep 6, 2023
1 parent 41de551 commit cbe87bc
Show file tree
Hide file tree
Showing 69 changed files with 450 additions and 447 deletions.
2 changes: 1 addition & 1 deletion docs
Submodule docs updated 131 files
8 changes: 4 additions & 4 deletions src/API.php
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ public function setWebApiTemplate(string $template): void
/**
* Constructor function.
*
* @param string $session Session name
* @param string $session Session name
* @param SettingsAbstract $settings Settings
*/
public function __construct(string $session, ?SettingsAbstract $settings = null)
Expand Down Expand Up @@ -302,8 +302,8 @@ protected function reconnectFull(): bool
/**
* Connect to MadelineProto.
*
* @param SettingsAbstract $settings Settings
* @param bool $forceFull Whether to force full initialization
* @param SettingsAbstract $settings Settings
* @param bool $forceFull Whether to force full initialization
*/
protected function connectToMadelineProto(SettingsAbstract $settings, bool $forceFull = false, bool $tryReconnect = true): bool
{
Expand Down Expand Up @@ -408,7 +408,7 @@ public function __destruct()
/**
* Start multiple instances of MadelineProto and the event handlers (enables async).
*
* @param array<API> $instances Instances of madeline
* @param array<API> $instances Instances of madeline
* @param array<class-string<EventHandler>>|class-string<EventHandler> $eventHandler Event handler(s)
*/
public static function startAndLoopMulti(array $instances, array|string $eventHandler): void
Expand Down
10 changes: 5 additions & 5 deletions src/AsyncTools.php
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ public static function callFork(callable|Generator|Future $callable, ...$args):
* Asynchronously lock a file
* Resolves with a callbable that MUST eventually be called in order to release the lock.
*
* @param string $file File to lock
* @param integer $operation Locking mode
* @param float $polling Polling interval
* @param ?Cancellation $token Cancellation token
* @param ?Closure $failureCb Failure callback, called only once if the first locking attempt fails.
* @param string $file File to lock
* @param integer $operation Locking mode
* @param float $polling Polling interval
* @param ?Cancellation $token Cancellation token
* @param ?Closure $failureCb Failure callback, called only once if the first locking attempt fails.
* @return ($token is null ? (Closure(): void) : ((Closure(): void)|null))
*/
public static function flock(string $file, int $operation, float $polling = 0.1, ?Cancellation $token = null, ?Closure $failureCb = null): ?Closure
Expand Down
8 changes: 4 additions & 4 deletions src/BotApiFileId.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
final class BotApiFileId
{
/**
* @param string $fileId The file ID
* @param integer $size The file size
* @param string $fileName The original file name
* @param bool $protected Whether the original file is protected
* @param string $fileId The file ID
* @param integer $size The file size
* @param string $fileName The original file name
* @param bool $protected Whether the original file is protected
*/
public function __construct(
public readonly string $fileId,
Expand Down
8 changes: 4 additions & 4 deletions src/Broadcast/Broadcast.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ trait Broadcast
* containing a Progress object for all broadcasts currently in-progress.
*
* @param array $messages The messages to send: an array of arrays, containing parameters to pass to messages.sendMessage.
* @param bool $pin Whether to also pin the last sent message.
* @param bool $pin Whether to also pin the last sent message.
*/
public function broadcastMessages(array $messages, ?Filter $filter = null, bool $pin = false): int
{
Expand All @@ -69,10 +69,10 @@ public function broadcastMessages(array $messages, ?Filter $filter = null, bool
* MadelineProto will also periodically emit updateBroadcastProgress updates,
* containing a Progress object for all broadcasts currently in-progress.
*
* @param mixed $from_peer Bot API ID or Update, from where to forward the messages.
* @param mixed $from_peer Bot API ID or Update, from where to forward the messages.
* @param list<int> $message_ids IDs of the messages to forward.
* @param bool $drop_author If true, will forward messages without quoting the original author.
* @param bool $pin Whether to also pin the last sent message.
* @param bool $drop_author If true, will forward messages without quoting the original author.
* @param bool $pin Whether to also pin the last sent message.
*/
public function broadcastForwardMessages(mixed $from_peer, array $message_ids, bool $drop_author = false, ?Filter $filter = null, bool $pin = false): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -458,7 +458,7 @@ private function methodAbstractions(string &$method, array &$arguments): ?Deferr
/**
* Send an MTProto message.
*
* @param boolean $flush Whether to flush the message right away
* @param boolean $flush Whether to flush the message right away
*/
public function sendMessage(MTProtoOutgoingMessage $message, bool $flush = true): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/DataCenter.php
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ private static function normalizeBindToOption(string $bindTo = null): ?string
/**
* Generate contexts.
*
* @param integer $dc_number DC ID to generate contexts for
* @param integer $dc_number DC ID to generate contexts for
*/
private function generateContexts(int $dc_number): ContextIterator
{
Expand Down
3 changes: 2 additions & 1 deletion src/DataCenterConnection.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@

/**
* Datacenter connection.
* @internal
*/
final class DataCenterConnection implements JsonSerializable
{
Expand Down Expand Up @@ -424,7 +425,7 @@ public function hasCtx(): bool
/**
* Connect function.
*
* @param int $id Optional connection ID to reconnect
* @param int $id Optional connection ID to reconnect
*/
public function connect(int $id = -1): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Db/DbArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ interface DbArray extends DbType, ArrayAccess, Traversable
/**
* Set element.
*
* @param TKey $index
* @param TKey $index
* @param TValue $value
*/
public function offsetSet(mixed $index, mixed $value): void;
Expand Down
6 changes: 3 additions & 3 deletions src/Db/DbArrayTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ trait DbArrayTrait
/**
* Check if key isset.
*
* @param TTKey $key
* @return bool true if the offset exists, otherwise false
* @param TTKey $key
* @return bool true if the offset exists, otherwise false
*/
final public function isset(string|int $key): bool
{
Expand All @@ -42,7 +42,7 @@ final public function offsetExists(mixed $index): bool
}

/**
* @param TTKey $index
* @param TTKey $index
* @param TTValue $value
*/
final public function offsetSet(mixed $index, mixed $value): void
Expand Down
2 changes: 1 addition & 1 deletion src/Db/DbType.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public function unset(string|int $key): void;
/**
* Set element.
*
* @param TKey $key
* @param TKey $key
* @param TValue $value
*/
public function set(string|int $key, mixed $value): void;
Expand Down
2 changes: 1 addition & 1 deletion src/Db/MemoryArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public static function getInstance(string $table, DbArray|null $previous, $setti
}

/**
* @param TKey $key
* @param TKey $key
* @param TValue $value
*/
public function set(string|int $key, mixed $value): void
Expand Down
2 changes: 1 addition & 1 deletion src/Db/RedisArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function getIterator(): \Traversable
*
* @link https://php.net/manual/en/arrayiterator.count.php
* @return int The number of elements or public properties in the associated
* array or object, respectively.
* array or object, respectively.
*/
public function count(): int
{
Expand Down
2 changes: 1 addition & 1 deletion src/Db/SqlArray.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public function unset(string|int $key): void
*
* @link https://php.net/manual/en/arrayiterator.count.php
* @return int The number of elements or public properties in the associated
* array or object, respectively.
* array or object, respectively.
*/
public function count(): int
{
Expand Down
1 change: 1 addition & 0 deletions src/DoHConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
use const STREAM_CLIENT_CONNECT;
use function Amp\Socket\Internal\parseUri;

/** @internal */
final class DoHConnector implements SocketConnector
{
public function __construct(private DoHWrapper $dataCenter, private ConnectionContext $ctx)
Expand Down
1 change: 1 addition & 0 deletions src/DoHWrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@

/**
* @psalm-import-type TDcList from DataCenter
* @internal
*/
final class DoHWrapper
{
Expand Down
4 changes: 2 additions & 2 deletions src/DocsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ public static function addToLang(string $key, string $value = '', bool $force =
/**
* Get formatted template string.
*
* @param string $name Template name
* @param string ...$params Params
* @param string $name Template name
* @param string ...$params Params
*/
protected function template(string $name, string ...$params): string
{
Expand Down
6 changes: 3 additions & 3 deletions src/EventHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ abstract class EventHandler extends AbstractAPI
*
* Also initializes error reporting, catching and reporting all errors surfacing from the event loop.
*
* @param string $session Session name
* @param string $session Session name
* @param ?SettingsAbstract $settings Settings
*/
final public static function startAndLoop(string $session, ?SettingsAbstract $settings = null): void
Expand All @@ -77,8 +77,8 @@ final public static function startAndLoop(string $session, ?SettingsAbstract $se
*
* Also initializes error reporting, catching and reporting all errors surfacing from the event loop.
*
* @param string $session Session name
* @param string $token Bot token
* @param string $session Session name
* @param string $token Bot token
* @param ?SettingsAbstract $settings Settings
*/
final public static function startAndLoopBot(string $session, string $token, ?SettingsAbstract $settings = null): void
Expand Down
22 changes: 11 additions & 11 deletions src/EventHandler/AbstractMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -187,16 +187,16 @@ public function delete(bool $revoke = true): void
/**
* Reply to the message.
*
* @param string $message Message to send
* @param ParseMode $parseMode Parse mode
* @param array|null $replyMarkup Keyboard information.
* @param integer|null $sendAs Peer to send the message as.
* @param integer|null $scheduleDate Schedule date.
* @param boolean $silent Whether to send the message silently, without triggering notifications.
* @param boolean $background Send this message as background message
* @param boolean $clearDraft Clears the draft field
* @param boolean $noWebpage Set this flag to disable generation of the webpage preview
* @param boolean $updateStickersetsOrder Whether to move used stickersets to top
* @param string $message Message to send
* @param ParseMode $parseMode Parse mode
* @param array|null $replyMarkup Keyboard information.
* @param integer|null $sendAs Peer to send the message as.
* @param integer|null $scheduleDate Schedule date.
* @param boolean $silent Whether to send the message silently, without triggering notifications.
* @param boolean $background Send this message as background message
* @param boolean $clearDraft Clears the draft field
* @param boolean $noWebpage Set this flag to disable generation of the webpage preview
* @param boolean $updateStickersetsOrder Whether to move used stickersets to top
*
*/
public function reply(
Expand Down Expand Up @@ -321,7 +321,7 @@ public function setAction(Action $action = new Typing): bool
/**
* Mark selected message as read.
*
* @param boolean $readAll
* @param boolean $readAll
* @return boolean if set, read all messages in current chat.
*/
public function read(bool $readAll = false): bool
Expand Down
8 changes: 4 additions & 4 deletions src/EventHandler/CallbackQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ public function __construct(MTProto $API, array $rawCallback)
}

/**
* @param string $message Popup to show
* @param bool $alert Whether to show the message as a popup instead of a toast notification
* @param string|null $url URL to open
* @param int $cacheTime Cache validity (default set to 5 min based on telegram official docs ...)
* @param string $message Popup to show
* @param bool $alert Whether to show the message as a popup instead of a toast notification
* @param string|null $url URL to open
* @param int $cacheTime Cache validity (default set to 5 min based on telegram official docs ...)
*/
public function answer(
string $message,
Expand Down
4 changes: 2 additions & 2 deletions src/EventHandler/Filter/FilterCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ final class FilterCommand extends Filter
*/
public readonly array $commandTypes;
/**
* @param string $command Command
* @param list<CommandType> $types Command types, if empty all command types are allowed.
* @param string $command Command
* @param list<CommandType> $types Command types, if empty all command types are allowed.
*/
public function __construct(private readonly string $command, array $types = [CommandType::BANG, CommandType::DOT, CommandType::SLASH])
{
Expand Down
32 changes: 16 additions & 16 deletions src/EventHandler/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ public function __construct(
* Pin a message.
*
* @param bool $pmOneside Whether the message should only be pinned on the local side of a one-to-one chat
* @param bool $silent Pin the message silently, without triggering a notification
* @param bool $silent Pin the message silently, without triggering a notification
*/
public function pin(bool $pmOneside = false, bool $silent = false): void
{
Expand All @@ -204,7 +204,7 @@ public function pin(bool $pmOneside = false, bool $silent = false): void
* Unpin a message.
*
* @param bool $pmOneside Whether the message should only be pinned on the local side of a one-to-one chat
* @param bool $silent Pin the message silently, without triggering a notification
* @param bool $silent Pin the message silently, without triggering a notification
*/
public function unpin(bool $pmOneside = false, bool $silent = false): ?Update
{
Expand Down Expand Up @@ -234,8 +234,8 @@ public function getOurReactions(): array
/**
* Report a message in a chat for violation of telegram’s Terms of Service.
*
* @param ReportReason $reason Why are these messages being reported
* @param string $message Comment for report moderation
* @param ReportReason $reason Why are these messages being reported
* @param string $message Comment for report moderation
*/
public function report(ReportReason $reason, string $message): bool
{
Expand All @@ -253,10 +253,10 @@ public function report(ReportReason $reason, string $message): bool
/**
* Save message sender to your account contacts.
*
* @param string $firstName First name
* @param string|null $lastName Last name
* @param string|null $phoneNumber Telegram ID of the other user
* @param bool $addPhonePrivacyException Allow the other user to see our phone number?
* @param string $firstName First name
* @param string|null $lastName Last name
* @param string|null $phoneNumber Telegram ID of the other user
* @param bool $addPhonePrivacyException Allow the other user to see our phone number?
*/
public function saveContact(
string $firstName,
Expand Down Expand Up @@ -308,9 +308,9 @@ public function inviteToChannel(string|int $channel): void
/**
* Add reaction to message.
*
* @param string|int $reaction reaction
* @param bool $big Whether a bigger and longer reaction should be shown
* @param bool $addToRecent Add this reaction to the recent reactions list.
* @param string|int $reaction reaction
* @param bool $big Whether a bigger and longer reaction should be shown
* @param bool $addToRecent Add this reaction to the recent reactions list.
*
* @return list<string|int>
*/
Expand Down Expand Up @@ -389,11 +389,11 @@ public function translate(
/**
* Edit message text.
*
* @param string $message New message
* @param ParseMode $parseMode Whether to parse HTML or Markdown markup in the message
* @param array|null $replyMarkup Reply markup for inline keyboards
* @param int|null $scheduleDate Scheduled message date for scheduled messages
* @param bool $noWebpage Disable webpage preview
* @param string $message New message
* @param ParseMode $parseMode Whether to parse HTML or Markdown markup in the message
* @param array|null $replyMarkup Reply markup for inline keyboards
* @param int|null $scheduleDate Scheduled message date for scheduled messages
* @param bool $noWebpage Disable webpage preview
*
*/
public function editText(
Expand Down
2 changes: 1 addition & 1 deletion src/EventHandler/Message/ChannelMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function enableSignatures(): void
/**
* Get info about a [channel/supergroup](https://core.telegram.org/api/channel) participant.
*
* @param string|integer $member Participant to get info about.
* @param string|integer $member Participant to get info about.
* @throws AssertionError
*/
public function getMember(string|int $member): Participant
Expand Down
2 changes: 1 addition & 1 deletion src/EventHandler/Message/Entities/MessageEntity.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ protected function __construct(array $rawEntities)
}

/**
* @param list<array> $entities
* @param list<array> $entities
* @return list<self>
*/
public static function fromRawEntities(array $entities): array
Expand Down
Loading

0 comments on commit cbe87bc

Please sign in to comment.