1
0
mirror of https://github.com/danog/MadelineProto.git synced 2025-01-22 18:51:13 +01:00
This commit is contained in:
Daniil Gentili 2023-01-04 12:46:23 +01:00
parent 9368f86099
commit b7fc451e87
5 changed files with 6 additions and 13 deletions

View File

@ -29,7 +29,6 @@ use danog\MadelineProto\SessionPaths;
use danog\MadelineProto\Tools;
use danog\MadelineProto\Wrappers\Start;
use danog\MadelineProto\Wrappers\Templates;
use Generator;
use Throwable;
use function Amp\async;
@ -201,11 +200,10 @@ class Client extends ClientAbstract
* If the $aargs['noResponse'] is true, will not wait for a response.
*
* @param string $method Method name
* @param array|Generator $args Arguments
* @param array $args Arguments
* @param array $aargs Additional arguments
* @psalm-param array|Generator<mixed, mixed, mixed, array> $args
*/
public function methodCallAsyncRead(string $method, $args, array $aargs)
public function methodCallAsyncRead(string $method, array $args, array $aargs)
{
if (\is_array($args)) {
if (($method === 'messages.editInlineBotMessage' ||

View File

@ -17,7 +17,6 @@ use danog\MadelineProto\Ipc\Wrapper\SeekableInputStream;
use danog\MadelineProto\Ipc\Wrapper\SeekableOutputStream;
use danog\MadelineProto\Logger;
use danog\MadelineProto\SessionPaths;
use Generator;
use Throwable;
use function Amp\async;
@ -147,7 +146,6 @@ class Wrapper extends ClientAbstract
{
try {
$result = $this->callbacks[$payload[0]](...$payload[1]);
$result = $result instanceof Generator ? $result : $result;
} catch (Throwable $e) {
$this->logger->logger("Got error while calling reverse IPC method: $e", Logger::ERROR);
$result = new ExitFailure($e);

View File

@ -24,7 +24,6 @@ use Amp\DeferredFuture;
use Amp\Future;
use danog\MadelineProto\Exception;
use danog\MadelineProto\MTProtoSession\MsgIdHandler;
use Generator;
use Revolt\EventLoop;
use function time;
@ -89,7 +88,7 @@ class OutgoingMessage extends Message
/**
* Message body.
*
* @var Generator|array|null
* @var array|null
*/
private $body;
@ -140,13 +139,13 @@ class OutgoingMessage extends Message
/**
* Create outgoing message.
*
* @param Generator|array $body Body
* @param array $body Body
* @param string $constructor Constructor name
* @param string $type Constructor type
* @param boolean $method Is this a method?
* @param boolean $unencrypted Is this an unencrypted message?
*/
public function __construct($body, string $constructor, string $type, bool $method, bool $unencrypted)
public function __construct(array $body, string $constructor, string $type, bool $method, bool $unencrypted)
{
$this->body = $body;
$this->constructor = $constructor;
@ -227,7 +226,7 @@ class OutgoingMessage extends Message
*/
public function getBody()
{
return $this->body instanceof Generator ? $this->body : $this->body;
return $this->body;
}
/**

View File

@ -21,7 +21,6 @@ declare(strict_types=1);
namespace danog\MadelineProto\MTProtoTools;
use danog\MadelineProto\Settings;
use Generator;
/**
* Manages method and object calls.

View File

@ -22,7 +22,6 @@ namespace danog\MadelineProto\MTProtoTools;
use Amp\DeferredFuture;
use Amp\File\Driver\BlockingFile;
use Amp\File\File;
use Amp\Future;
use Amp\Http\Client\Request;
use danog\MadelineProto\Exception;