cs-fix
This commit is contained in:
parent
7a9da5718e
commit
8ea90f796b
@ -4,7 +4,8 @@ $config = new Amp\CodeStyle\Config();
|
||||
$config->getFinder()
|
||||
->in(__DIR__ . '/src')
|
||||
->in(__DIR__ . '/tests')
|
||||
->in(__DIR__ . '/userbots')
|
||||
->in(__DIR__ . '/examples')
|
||||
->in(__DIR__ . '/tools')
|
||||
->in(__DIR__);
|
||||
|
||||
$cacheDir = getenv('TRAVIS') ? getenv('HOME') . '/.php-cs-fixer' : __DIR__;
|
||||
|
@ -30,7 +30,7 @@ class AnnotationsBuilder
|
||||
public function __construct($logger, $settings)
|
||||
{
|
||||
$this->logger = $logger;
|
||||
$this->construct_TL($settings['tl_schema']);
|
||||
$this->constructTL($settings['tl_schema']);
|
||||
$this->settings = $settings;
|
||||
}
|
||||
|
||||
|
@ -32,7 +32,7 @@ class DocsBuilder
|
||||
{
|
||||
$this->logger = $logger;
|
||||
\set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']);
|
||||
$this->construct_TL($settings['tl_schema']);
|
||||
$this->constructTL($settings['tl_schema']);
|
||||
if (isset($settings['tl_schema']['td']) && !isset($settings['tl_schema']['telegram'])) {
|
||||
$this->constructors = $this->td_constructors;
|
||||
$this->methods = $this->td_methods;
|
||||
@ -77,7 +77,7 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
|
||||
[Constructors](constructors/)
|
||||
|
||||
[Types](types/)');
|
||||
$this->mk_methodS();
|
||||
$this->mkmethodS();
|
||||
$this->mkConstructors();
|
||||
foreach (\glob('types/*') as $unlink) {
|
||||
\unlink($unlink);
|
||||
|
@ -4302,6 +4302,22 @@ class InternalDoc extends APIFactory
|
||||
{
|
||||
return $this->__call(__FUNCTION__, [$id, $extra]);
|
||||
}
|
||||
/**
|
||||
* Synchronous wrapper for method_call.
|
||||
*
|
||||
* @param string $method Method name
|
||||
* @param array $args Arguments
|
||||
* @param array $aargs Additional arguments
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function methodCall(string $method, $args = [
|
||||
], array $aargs = [
|
||||
'msg_id' => null,
|
||||
], array $extra = [])
|
||||
{
|
||||
return $this->__call(__FUNCTION__, [$method, $args, $aargs, $extra]);
|
||||
}
|
||||
/**
|
||||
* Call method and wait asynchronously for response.
|
||||
*
|
||||
@ -4313,7 +4329,7 @@ class InternalDoc extends APIFactory
|
||||
*
|
||||
* @return Promise
|
||||
*/
|
||||
public function methodCall(string $method, $args = [
|
||||
public function methodCallRead(string $method, $args = [
|
||||
], array $aargs = [
|
||||
'msg_id' => null,
|
||||
], array $extra = [])
|
||||
@ -5049,8 +5065,16 @@ class InternalDoc extends APIFactory
|
||||
{
|
||||
return $this->__call(__FUNCTION__, [$a, $b, $extra]);
|
||||
}
|
||||
|
||||
public function flock(string $file, int $operation, $polling, array $extra = [])
|
||||
/**
|
||||
* 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 (see flock)
|
||||
* @param numeric $polling Polling interval for lock
|
||||
* @return Promise
|
||||
*/
|
||||
public function flock(string $file, int $operation, $polling = 0.1, array $extra = [])
|
||||
{
|
||||
return $this->__call(__FUNCTION__, [$file, $operation, $polling, $extra]);
|
||||
}
|
||||
@ -5060,6 +5084,11 @@ class InternalDoc extends APIFactory
|
||||
return $this->__call(__FUNCTION__, [$status, $message, $extra]);
|
||||
}
|
||||
|
||||
public function flockGenerator(string $file, int $operation, $polling, array $extra = [])
|
||||
{
|
||||
return $this->__call(__FUNCTION__, [$file, $operation, $polling, $extra]);
|
||||
}
|
||||
|
||||
public function sleep($time, array $extra = [])
|
||||
{
|
||||
return $this->__call(__FUNCTION__, [$time, $extra]);
|
||||
@ -5070,6 +5099,11 @@ class InternalDoc extends APIFactory
|
||||
return $this->__call(__FUNCTION__, [$prompt, $extra]);
|
||||
}
|
||||
|
||||
public function readLineGenerator($prompt = '', array $extra = [])
|
||||
{
|
||||
return $this->__call(__FUNCTION__, [$prompt, $extra]);
|
||||
}
|
||||
|
||||
public function echo($string, array $extra = [])
|
||||
{
|
||||
return $this->__call(__FUNCTION__, [$string, $extra]);
|
||||
|
@ -471,7 +471,7 @@ class MTProto extends AsyncConstruct implements TLCallback
|
||||
if (!($this->authorization['user']['bot'] ?? false)) {
|
||||
$callbacks []= $this->minDatabase;
|
||||
}
|
||||
$this->construct_TL($this->settings['tl_schema']['src'], $callbacks);
|
||||
$this->constructTL($this->settings['tl_schema']['src'], $callbacks);
|
||||
yield $this->connectToAllDcs();
|
||||
$this->startLoops();
|
||||
$this->datacenter->curdc = 2;
|
||||
|
@ -42,7 +42,7 @@ class Handler extends \danog\MadelineProto\Connection
|
||||
$this->sock->setOption(\SOL_SOCKET, \SO_RCVTIMEO, $timeout);
|
||||
$this->sock->setOption(\SOL_SOCKET, \SO_SNDTIMEO, $timeout);
|
||||
$this->logger = new \danog\MadelineProto\Logger(3);
|
||||
$this->construct_TL(['socket' => __DIR__.'/../TL_socket.tl']);
|
||||
$this->constructTL(['socket' => __DIR__.'/../TL_socket.tl']);
|
||||
}
|
||||
|
||||
public function __destruct()
|
||||
|
@ -11,9 +11,12 @@
|
||||
* If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
\chdir($d=__DIR__.'/..');
|
||||
|
||||
require 'vendor/autoload.php';
|
||||
|
||||
$param = 1;
|
||||
\danog\MadelineProto\Magic::classExists();
|
||||
\danog\MadelineProto\Logger::constructor($param);
|
||||
$logger = \danog\MadelineProto\Logger::$default;
|
||||
|
||||
@ -30,37 +33,37 @@ image: https://docs.madelineproto.xyz/favicons/android-chrome-256x256.png
|
||||
|
||||
$docs = [
|
||||
/* [
|
||||
'tl_schema' => ['td' => __DIR__.'/src/danog/MadelineProto/TL_td.tl'],
|
||||
'tl_schema' => ['td' => "$d/src/danog/MadelineProto/TL_td.tl"],
|
||||
'title' => 'MadelineProto API documentation (td-lib)',
|
||||
'description' => 'MadelineProto API documentation (td-lib)',
|
||||
'output_dir' => __DIR__.'/docs/docs/TD_docs',
|
||||
'output_dir' => "$d/docs/docs/TD_docs",
|
||||
'readme' => false,
|
||||
'td' => true,
|
||||
],*/
|
||||
[
|
||||
'tl_schema' => ['mtproto' => __DIR__.'/src/danog/MadelineProto/TL_mtproto_v1.json'],
|
||||
'tl_schema' => ['mtproto' => "$d/src/danog/MadelineProto/TL_mtproto_v1.json"],
|
||||
'title' => 'MadelineProto API documentation (mtproto)',
|
||||
'description' => 'MadelineProto API documentation (mtproto)',
|
||||
'output_dir' => __DIR__.'/docs/docs/MTProto_docs',
|
||||
'output_dir' => "$d/docs/docs/MTProto_docs",
|
||||
'readme' => false,
|
||||
],
|
||||
[
|
||||
'tl_schema' => ['telegram' => __DIR__.'/src/danog/MadelineProto/TL_telegram_v105.tl', 'calls' => __DIR__.'/src/danog/MadelineProto/TL_calls.tl', 'secret' => __DIR__.'/src/danog/MadelineProto/TL_secret.tl', 'td' => __DIR__.'/src/danog/MadelineProto/TL_td.tl'],
|
||||
'tl_schema' => ['telegram' => "$d/src/danog/MadelineProto/TL_telegram_v105.tl", 'calls' => "$d/src/danog/MadelineProto/TL_calls.tl", 'secret' => "$d/src/danog/MadelineProto/TL_secret.tl", 'td' => "$d/src/danog/MadelineProto/TL_td.tl"],
|
||||
'title' => 'MadelineProto API documentation (layer 105)',
|
||||
'description' => 'MadelineProto API documentation (layer 105)',
|
||||
'output_dir' => __DIR__.'/docs/docs/API_docs',
|
||||
'output_dir' => "$d/docs/docs/API_docs",
|
||||
'readme' => false,
|
||||
],
|
||||
];
|
||||
|
||||
$layer_list = '';
|
||||
foreach (\array_slice(\glob(__DIR__.'/src/danog/MadelineProto/TL_telegram_*'), 0, -1) as $file) {
|
||||
foreach (\array_slice(\glob("$d/src/danog/MadelineProto/TL_telegram_*"), 0, -1) as $file) {
|
||||
$layer = \preg_replace(['/.*telegram_/', '/\..+/'], '', $file);
|
||||
$docs[] = [
|
||||
'tl_schema' => ['telegram' => $file],
|
||||
'title' => 'MadelineProto API documentation (layer '.$layer.')',
|
||||
'description' => 'MadelineProto API documentation (layer '.$layer.')',
|
||||
'output_dir' => __DIR__.'/docs/old_docs/API_docs_'.$layer,
|
||||
'output_dir' => "$d/docs/old_docs/API_docs_".$layer,
|
||||
'readme' => true,
|
||||
];
|
||||
$layer_list = '[Layer '.$layer.'](API_docs_'.$layer.'/)
|
||||
@ -76,14 +79,14 @@ description: Documentation of old mtproto layers
|
||||
'.$layer_list);
|
||||
|
||||
$doc = new \danog\MadelineProto\AnnotationsBuilder($logger, $docs[1]);
|
||||
$doc->mk_annotations();
|
||||
$doc->mkAnnotations();
|
||||
|
||||
foreach ($docs as $settings) {
|
||||
$doc = new \danog\MadelineProto\DocsBuilder($logger, $settings);
|
||||
$doc->mk_docs();
|
||||
$doc->mkDocs();
|
||||
}
|
||||
|
||||
\chdir(__DIR__);
|
||||
\chdir(__DIR__.'/..');
|
||||
|
||||
$orderedfiles = [];
|
||||
$order = [
|
||||
|
@ -13,7 +13,7 @@ foreach ($classes as $class) {
|
||||
$class = new \ReflectionClass($class);
|
||||
$methods = \array_merge($class->getMethods(), $methods);
|
||||
}
|
||||
$methods = array_unique($methods);
|
||||
$methods = \array_unique($methods);
|
||||
|
||||
function ssort($a, $b)
|
||||
{
|
||||
@ -31,14 +31,16 @@ foreach ($methods as $methodObj) {
|
||||
}
|
||||
$new = Tools::from_snake_case($method);
|
||||
$new = \str_ireplace(['mtproto', 'api'], ['MTProto', 'API'], $new);
|
||||
if (!in_array($method, ['discard_call_async', 'accept_call_async', 'request_call_async'])) $new = preg_replace('/async$/i', '', $new);
|
||||
if (!\in_array($method, ['discard_call_async', 'accept_call_async', 'request_call_async'])) {
|
||||
$new = \preg_replace('/async$/i', '', $new);
|
||||
}
|
||||
|
||||
if (method_exists((string) $methodObj->getDeclaringClass(), preg_replace('/async$/i', '', $method))) {
|
||||
var_dump("Skipping $method => $new");
|
||||
if (\method_exists((string) $methodObj->getDeclaringClass(), \preg_replace('/async$/i', '', $method))) {
|
||||
\var_dump("Skipping $method => $new");
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!function_exists($method)) {
|
||||
if (!\function_exists($method)) {
|
||||
$find[] = "$method(";
|
||||
$replace[] = "$new(";
|
||||
continue;
|
||||
|
Loading…
Reference in New Issue
Block a user