From 7a21c25e35adc4cb29f888c821eb0eb01d7a3501 Mon Sep 17 00:00:00 2001 From: Daniil Gentili Date: Thu, 28 Sep 2017 19:38:43 +0200 Subject: [PATCH] Fixes to DocsBuilder --- src/danog/MadelineProto/DocsBuilder.php | 10 ++++++++++ src/danog/MadelineProto/DocsBuilder/Constructors.php | 6 +++--- src/danog/MadelineProto/DocsBuilder/Methods.php | 10 +++++----- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/src/danog/MadelineProto/DocsBuilder.php b/src/danog/MadelineProto/DocsBuilder.php index 95b9b28e..46f8d683 100644 --- a/src/danog/MadelineProto/DocsBuilder.php +++ b/src/danog/MadelineProto/DocsBuilder.php @@ -422,6 +422,16 @@ description: A 32 bit signed integer ranging from -2147483648 to 2147483647 [Back to constructor index](index.md) A 32 bit signed integer ranging from `-2147483648` to `2147483647`. +'); + + file_put_contents('types/int53.md', '--- +title: integer +description: A 53 bit signed integer +--- +## Type: int53 +[Back to constructor index](index.md) + +A 53 bit signed integer. '); file_put_contents('types/long.md', '--- diff --git a/src/danog/MadelineProto/DocsBuilder/Constructors.php b/src/danog/MadelineProto/DocsBuilder/Constructors.php index 3a81268b..b5886652 100644 --- a/src/danog/MadelineProto/DocsBuilder/Constructors.php +++ b/src/danog/MadelineProto/DocsBuilder/Constructors.php @@ -54,12 +54,12 @@ trait Constructors if (in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) { continue; } - if ($type === 'EncryptedMessage' && $param['name'] === 'bytes') { + if ($type === 'EncryptedMessage' && $param['name'] === 'bytes' && !isset($this->settings['td'])) { $param['name'] = 'decrypted_message'; $param['type'] = 'DecryptedMessage'; } $type_or_subtype = isset($param['subtype']) ? 'subtype' : 'type'; - $type_or_bare_type = (ctype_upper($this->end(explode('.', $param[$type_or_subtype]))[0]) || in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int', 'long', 'int128', 'int256', 'int512'])) ? 'types' : 'constructors'; + $type_or_bare_type = (ctype_upper($this->end(explode('.', $param[$type_or_subtype]))[0]) || in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int53', 'int', 'long', 'int128', 'int256', 'int512'])) ? 'types' : 'constructors'; $param[$type_or_subtype] = str_replace(['.', 'true', 'false'], ['_', 'Bool', 'Bool'], $param[$type_or_subtype]); @@ -95,7 +95,7 @@ trait Constructors if (in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) { continue; } - if ($type === 'EncryptedMessage' && $param['name'] === 'bytes') { + if ($type === 'EncryptedMessage' && $param['name'] === 'bytes' && !isset($this->settings['td'])) { $param['name'] = 'decrypted_message'; $param['type'] = 'DecryptedMessage'; } diff --git a/src/danog/MadelineProto/DocsBuilder/Methods.php b/src/danog/MadelineProto/DocsBuilder/Methods.php index 47bbf456..a3a8c2b7 100644 --- a/src/danog/MadelineProto/DocsBuilder/Methods.php +++ b/src/danog/MadelineProto/DocsBuilder/Methods.php @@ -48,15 +48,15 @@ trait Methods if (in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) { continue; } - if ($param['name'] === 'data' && $type === 'messages_SentEncryptedMessage') { + if ($param['name'] === 'data' && $type === 'messages_SentEncryptedMessage' && !isset($this->settings['td'])) { $param['name'] = 'message'; $param['type'] = 'DecryptedMessage'; } - if ($param['name'] === 'chat_id' && $data['method'] !== 'messages.discardEncryption') { + if ($param['name'] === 'chat_id' && $data['method'] !== 'messages.discardEncryption' && !isset($this->settings['td'])) { $param['type'] = 'InputPeer'; } $type_or_subtype = isset($param['subtype']) ? 'subtype' : 'type'; - $type_or_bare_type = (ctype_upper($this->end(explode('.', $param[$type_or_subtype]))[0]) || in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int', 'long', 'int128', 'int256', 'int512'])) ? 'types' : 'constructors'; + $type_or_bare_type = (ctype_upper($this->end(explode('.', $param[$type_or_subtype]))[0]) || in_array($param[$type_or_subtype], ['!X', 'X', 'bytes', 'true', 'false', 'double', 'string', 'Bool', 'int', 'long', 'int128', 'int256', 'int512', 'int53'])) ? 'types' : 'constructors'; $param[$type_or_subtype] = str_replace(['.', 'true', 'false'], ['_', 'Bool', 'Bool'], $param[$type_or_subtype]); $param[$type_or_subtype] = '['.$this->escape($param[$type_or_subtype]).'](../'.$type_or_bare_type.'/'.$param[$type_or_subtype].'.md)'; @@ -93,11 +93,11 @@ trait Methods if (in_array($param['name'], ['flags', 'random_id', 'random_bytes'])) { continue; } - if ($param['name'] === 'data' && $type === 'messages_SentEncryptedMessage') { + if ($param['name'] === 'data' && $type === 'messages_SentEncryptedMessage' && !isset($this->settings['td'])) { $param['name'] = 'message'; $param['type'] = 'DecryptedMessage'; } - if ($param['name'] === 'chat_id' && $data['method'] !== 'messages.discardEncryption') { + if ($param['name'] === 'chat_id' && $data['method'] !== 'messages.discardEncryption' && !isset($this->settings['td'])) { $param['type'] = 'InputPeer'; }