From c5506f5a746759411bf0eae859e4f60808ff3a69 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Sat, 14 Sep 2019 15:39:42 +0200 Subject: [PATCH] cs-fix --- docs | 2 +- src/danog/MadelineProto/API.php | 2 +- src/danog/MadelineProto/Coroutine.php | 4 ++-- src/danog/MadelineProto/MTProtoTools/MinDatabase.php | 4 +++- src/danog/MadelineProto/MTProtoTools/PeerHandler.php | 5 +++-- src/danog/MadelineProto/TL/PrettyException.php | 2 -- src/danog/MadelineProto/Tools.php | 1 - 7 files changed, 10 insertions(+), 10 deletions(-) diff --git a/docs b/docs index fe346258..042cc043 160000 --- a/docs +++ b/docs @@ -1 +1 @@ -Subproject commit fe346258733323e5173e674f15059dea1a1eb880 +Subproject commit 042cc04351a461f551a9de7bf704290040910b37 diff --git a/src/danog/MadelineProto/API.php b/src/danog/MadelineProto/API.php index a756e2a4..260973c7 100644 --- a/src/danog/MadelineProto/API.php +++ b/src/danog/MadelineProto/API.php @@ -33,7 +33,7 @@ class API extends APIFactory public $session; public $serialized = 0; /** - * Instance of MadelineProto + * Instance of MadelineProto. * * @var MTProto */ diff --git a/src/danog/MadelineProto/Coroutine.php b/src/danog/MadelineProto/Coroutine.php index b9afdc4a..ad084c35 100644 --- a/src/danog/MadelineProto/Coroutine.php +++ b/src/danog/MadelineProto/Coroutine.php @@ -212,10 +212,10 @@ final class Coroutine implements Promise, \ArrayAccess } /** - * Get stacktrace from when the generator was started + * Get stacktrace from when the generator was started. * * @param integer $options Backtrace options - * + * * @return array */ public function getTrace(int $options = \DEBUG_BACKTRACE_PROVIDE_OBJECT): array diff --git a/src/danog/MadelineProto/MTProtoTools/MinDatabase.php b/src/danog/MadelineProto/MTProtoTools/MinDatabase.php index d7ab33f3..47f4ad7c 100644 --- a/src/danog/MadelineProto/MTProtoTools/MinDatabase.php +++ b/src/danog/MadelineProto/MTProtoTools/MinDatabase.php @@ -230,7 +230,9 @@ class MinDatabase implements TLCallback throw new \danog\MadelineProto\Exception("Unknown origin type provided: {$data['_']}"); } foreach ($cache as $id) { - if ($origin['peer'] === $id) continue; + if ($origin['peer'] === $id) { + continue; + } $this->db[$id] = $origin; } $this->API->logger->logger("Added origin ({$data['_']}) to ".\count($cache).' peer locations', \danog\MadelineProto\Logger::ULTRA_VERBOSE); diff --git a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php index 821af4f8..986e5107 100644 --- a/src/danog/MadelineProto/MTProtoTools/PeerHandler.php +++ b/src/danog/MadelineProto/MTProtoTools/PeerHandler.php @@ -58,8 +58,7 @@ trait PeerHandler if (isset($this->chats[$user['id']]['access_hash']) && $this->chats[$user['id']]['access_hash']) { $this->logger->logger("No access hash with user {$user['id']}, using backup"); $user['access_hash'] = $this->chats[$user['id']]['access_hash']; - - } else if (!isset($this->caching_simple[$user['id']]) && !(isset($user['username']) && isset($this->caching_simple_username[$user['username']]))) { + } elseif (!isset($this->caching_simple[$user['id']]) && !(isset($user['username']) && isset($this->caching_simple_username[$user['username']]))) { $this->logger->logger("No access hash with user {$user['id']}, trying to fetch by ID..."); if (isset($user['username']) && !isset($this->caching_simple_username[$user['username']])) { $this->caching_possible_username[$user['id']] = $user['username']; @@ -509,6 +508,7 @@ trait PeerHandler } foreach ($this->chats as $bot_api_id => $chat) { if (isset($chat['username']) && \strtolower($chat['username']) === $id) { + if ($chat['min'] ?? false) { $this->logger->logger("Only have min peer for $bot_api_id in database, trying to fetch full info"); try { if ($bot_api_id < 0) { @@ -521,6 +521,7 @@ trait PeerHandler } catch (\danog\MadelineProto\RPCErrorException $e) { $this->logger->logger($e->getMessage(), \danog\MadelineProto\Logger::WARNING); } + } return $this->gen_all($chat, $folder_id); } diff --git a/src/danog/MadelineProto/TL/PrettyException.php b/src/danog/MadelineProto/TL/PrettyException.php index 421770c0..bbaf3f31 100644 --- a/src/danog/MadelineProto/TL/PrettyException.php +++ b/src/danog/MadelineProto/TL/PrettyException.php @@ -19,8 +19,6 @@ namespace danog\MadelineProto\TL; -use danog\MadelineProto\Tools; - trait PrettyException { public $tl_trace; diff --git a/src/danog/MadelineProto/Tools.php b/src/danog/MadelineProto/Tools.php index fd74a34d..df35f6e5 100644 --- a/src/danog/MadelineProto/Tools.php +++ b/src/danog/MadelineProto/Tools.php @@ -25,7 +25,6 @@ use Amp\Loop; use Amp\Promise; use Amp\Success; use phpseclib\Math\BigInteger; -use ReflectionGenerator; use function Amp\ByteStream\getOutputBufferStream; use function Amp\ByteStream\getStdin;