diff --git a/src/ReflectionGenerator.php b/src/ReflectionGenerator.php deleted file mode 100644 index 3daffefd..00000000 --- a/src/ReflectionGenerator.php +++ /dev/null @@ -1,37 +0,0 @@ -generator = $generator; - } - public function getExecutingFile(): string - { - return ''; - } - public function getExecutingGenerator(): Generator - { - return $this->generator; - } - public function getExecutingLine(): int - { - return 0; - } - public function getFunction(): ReflectionFunctionAbstract - { - return new ReflectionFunction(function () { - }); - } - public function getThis(): object - { - return $this; - } - public function getTrace(int $options = DEBUG_BACKTRACE_PROVIDE_OBJECT): array - { - return []; - } - } -} diff --git a/src/danog/MadelineProto/Async/AsyncConstruct.php b/src/danog/MadelineProto/Async/AsyncConstruct.php index 2a5479c6..ba1fa6ae 100644 --- a/src/danog/MadelineProto/Async/AsyncConstruct.php +++ b/src/danog/MadelineProto/Async/AsyncConstruct.php @@ -19,6 +19,7 @@ namespace danog\MadelineProto\Async; +use Amp\Promise; use danog\MadelineProto\Tools; /** diff --git a/src/danog/MadelineProto/CombinedAPI.php b/src/danog/MadelineProto/CombinedAPI.php index 4a71fe6c..2acf9b4b 100644 --- a/src/danog/MadelineProto/CombinedAPI.php +++ b/src/danog/MadelineProto/CombinedAPI.php @@ -102,9 +102,6 @@ class CombinedAPI } public function __destruct() { - if (\danog\MadelineProto\Magic::$has_thread && \is_object(\Thread::getCurrentThread()) || Magic::isFork()) { - return; - } $this->serialize(); } public function serialize($filename = '') diff --git a/src/danog/MadelineProto/Connection.php b/src/danog/MadelineProto/Connection.php index 7325052a..1b9c03af 100644 --- a/src/danog/MadelineProto/Connection.php +++ b/src/danog/MadelineProto/Connection.php @@ -30,6 +30,7 @@ use danog\MadelineProto\MTProtoSession\Session; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\MTProtoTransport\HttpsStream; use danog\MadelineProto\Stream\MTProtoTransport\HttpStream; +use danog\MadelineProto\Stream\StreamInterface; use danog\MadelineProto\Stream\Transport\WssStream; use danog\MadelineProto\Stream\Transport\WsStream; @@ -77,7 +78,7 @@ class Connection extends Session /** * The actual socket. * - * @var Stream + * @var StreamInterface */ public $stream; /** diff --git a/src/danog/MadelineProto/DataCenter.php b/src/danog/MadelineProto/DataCenter.php index f3a4758e..c714c7e7 100644 --- a/src/danog/MadelineProto/DataCenter.php +++ b/src/danog/MadelineProto/DataCenter.php @@ -29,7 +29,8 @@ use Amp\Http\Client\Connection\UnlimitedConnectionPool; use Amp\Http\Client\Cookie\CookieInterceptor; use Amp\Http\Client\Cookie\CookieJar; use Amp\Http\Client\Cookie\InMemoryCookieJar; -use Amp\Http\Client\DelegateHttpClient; +use Amp\Http\Client\HttpClient; +use Amp\Http\Client\HttpClient; use Amp\Http\Client\HttpClientBuilder; use Amp\Http\Client\Request; use Amp\Socket\ConnectContext; @@ -94,7 +95,7 @@ class DataCenter /** * HTTP client. * - * @var \Amp\Http\Client\DelegateHttpClient + * @var \Amp\Http\Client\HttpClient */ private $HTTPClient; /** @@ -506,9 +507,9 @@ class DataCenter /** * Get async HTTP client. * - * @return \Amp\Http\Client\DelegateHttpClient + * @return \Amp\Http\Client\HttpClient */ - public function getHTTPClient(): DelegateHttpClient + public function getHTTPClient(): HttpClient { return $this->HTTPClient; } diff --git a/src/danog/MadelineProto/InternalDoc.php b/src/danog/MadelineProto/InternalDoc.php index bdc01d7e..4c7c1ae7 100644 --- a/src/danog/MadelineProto/InternalDoc.php +++ b/src/danog/MadelineProto/InternalDoc.php @@ -4210,9 +4210,9 @@ class InternalDoc extends APIFactory /** * Get async HTTP client. * - * @return \Amp\Http\Client\DelegateHttpClient + * @return \Amp\Http\Client\HttpClient */ - public function getHTTPClient(): \Amp\Http\Client\DelegateHttpClient + public function getHTTPClient(): \Amp\Http\Client\HttpClient { return $this->API->getHTTPClient(); } diff --git a/src/danog/MadelineProto/Loop/Impl/ResumableSignalLoop.php b/src/danog/MadelineProto/Loop/Impl/ResumableSignalLoop.php index 34b5e5d4..e31272a6 100644 --- a/src/danog/MadelineProto/Loop/Impl/ResumableSignalLoop.php +++ b/src/danog/MadelineProto/Loop/Impl/ResumableSignalLoop.php @@ -58,7 +58,7 @@ abstract class ResumableSignalLoop extends SignalLoop implements ResumableLoopIn } return $this->resume->promise(); } - public function resume($watcherId = null, $expected = 0) + public function resume($watcherId = null, $expected = 0): void { if ($this->resumeWatcher) { $storedWatcherId = $this->resumeWatcher; diff --git a/src/danog/MadelineProto/Loop/ResumableLoopInterface.php b/src/danog/MadelineProto/Loop/ResumableLoopInterface.php index b151c0d5..c7aafb98 100644 --- a/src/danog/MadelineProto/Loop/ResumableLoopInterface.php +++ b/src/danog/MadelineProto/Loop/ResumableLoopInterface.php @@ -41,5 +41,5 @@ interface ResumableLoopInterface extends LoopInterface * * @return void */ - public function resume(); + public function resume(): void; } diff --git a/src/danog/MadelineProto/Loop/SignalLoopInterface.php b/src/danog/MadelineProto/Loop/SignalLoopInterface.php index cab4db74..ed21c33a 100644 --- a/src/danog/MadelineProto/Loop/SignalLoopInterface.php +++ b/src/danog/MadelineProto/Loop/SignalLoopInterface.php @@ -39,9 +39,9 @@ interface SignalLoopInterface extends LoopInterface /** * Send a signal to the the loop. * - * @param Exception|any $data Signal to send + * @param \Throwable|any $data Signal to send * * @return void */ - public function signal($data); + public function signal($data): void; } diff --git a/src/danog/MadelineProto/MTProto.php b/src/danog/MadelineProto/MTProto.php index 4fcfb8be..e829b6b9 100644 --- a/src/danog/MadelineProto/MTProto.php +++ b/src/danog/MadelineProto/MTProto.php @@ -21,7 +21,7 @@ namespace danog\MadelineProto; use Amp\Dns\Resolver; use Amp\File\StatCache; -use Amp\Http\Client\DelegateHttpClient; +use Amp\Http\Client\HttpClient; use Amp\Loop; use danog\MadelineProto\Async\AsyncConstruct; use danog\MadelineProto\Loop\Generic\PeriodicLoop; @@ -346,31 +346,31 @@ class MTProto extends AsyncConstruct implements TLCallback /** * TOS check loop. * - * @var \danog\MadelineProto\Loop\Update\PeriodicLoop + * @var PeriodicLoop */ public $checkTosLoop; /** * Phone config loop. * - * @var \danog\MadelineProto\Loop\Update\PeriodicLoop + * @var PeriodicLoop */ public $phoneConfigLoop; /** * Config loop. * - * @var \danog\MadelineProto\Loop\Update\PeriodicLoop + * @var PeriodicLoop */ public $configLoop; /** * Call checker loop. * - * @var \danog\MadelineProto\Loop\Update\PeriodicLoop + * @var PeriodicLoop */ private $callCheckerLoop; /** * Autoserialization loop. * - * @var \danog\MadelineProto\Loop\Update\PeriodicLoop + * @var PeriodicLoop */ private $serializeLoop; /** @@ -610,9 +610,9 @@ class MTProto extends AsyncConstruct implements TLCallback /** * Get async HTTP client. * - * @return \Amp\Http\Client\DelegateHttpClient + * @return \Amp\Http\Client\HttpClient */ - public function getHTTPClient(): DelegateHttpClient + public function getHTTPClient(): HttpClient { return $this->datacenter->getHTTPClient(); } diff --git a/src/danog/MadelineProto/MTProtoSession/Session.php b/src/danog/MadelineProto/MTProtoSession/Session.php index bfa0d2e8..48669a54 100644 --- a/src/danog/MadelineProto/MTProtoSession/Session.php +++ b/src/danog/MadelineProto/MTProtoSession/Session.php @@ -40,7 +40,7 @@ abstract class Session /** * Message ID handler. * - * @var MsgIdHandlerAbstract + * @var MsgIdHandler */ public $msgIdHandler; /** diff --git a/src/danog/MadelineProto/MTProtoTools/Files.php b/src/danog/MadelineProto/MTProtoTools/Files.php index edb67793..1c29e318 100644 --- a/src/danog/MadelineProto/MTProtoTools/Files.php +++ b/src/danog/MadelineProto/MTProtoTools/Files.php @@ -900,7 +900,7 @@ trait Files \header("$key: $subValue", false); } } else { - \header("$key: $subValue"); + \header("$key: $value"); } } \http_response_code($result['code']); diff --git a/src/danog/MadelineProto/Stream/ADNLTransport/ADNLStream.php b/src/danog/MadelineProto/Stream/ADNLTransport/ADNLStream.php index cb64d0e1..aa2e5979 100644 --- a/src/danog/MadelineProto/Stream/ADNLTransport/ADNLStream.php +++ b/src/danog/MadelineProto/Stream/ADNLTransport/ADNLStream.php @@ -64,7 +64,7 @@ class ADNLStream implements BufferedStreamInterface, MTProtoBufferInterface * * @param int $length Length of data that is going to be written to the write buffer * - * @return Generator + * @return \Generator */ public function getWriteBufferGenerator(int $length, string $append = ''): \Generator { @@ -81,7 +81,7 @@ class ADNLStream implements BufferedStreamInterface, MTProtoBufferInterface * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBufferGenerator(&$length): \Generator { diff --git a/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php b/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php index 2753a64c..ab3d5c4a 100644 --- a/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php +++ b/src/danog/MadelineProto/Stream/Common/BufferedRawStream.php @@ -84,7 +84,7 @@ class BufferedRawStream implements BufferedStreamInterface, BufferInterface, Raw /** * Async close. * - * @return Generator + * @return \Generator */ public function disconnect() { diff --git a/src/danog/MadelineProto/Stream/Common/CtrStream.php b/src/danog/MadelineProto/Stream/Common/CtrStream.php index 14900f6a..813d395b 100644 --- a/src/danog/MadelineProto/Stream/Common/CtrStream.php +++ b/src/danog/MadelineProto/Stream/Common/CtrStream.php @@ -81,7 +81,7 @@ class CtrStream implements BufferedProxyStreamInterface, BufferInterface * * @param int $length Length of data that is going to be written to the write buffer * - * @return Generator + * @return \Generator */ public function getWriteBufferGenerator(int $length, string $append = ''): \Generator { @@ -97,7 +97,7 @@ class CtrStream implements BufferedProxyStreamInterface, BufferInterface * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBufferGenerator(&$length): \Generator { @@ -111,7 +111,7 @@ class CtrStream implements BufferedProxyStreamInterface, BufferInterface * * @throws PendingReadError Thrown if another read operation is still pending. * - * @return Generator That resolves with a string when the provided promise is resolved and the data is decrypted + * @return \Generator That resolves with a string when the provided promise is resolved and the data is decrypted */ public function bufferReadGenerator(int $length): \Generator { diff --git a/src/danog/MadelineProto/Stream/Common/HashedBufferedStream.php b/src/danog/MadelineProto/Stream/Common/HashedBufferedStream.php index db4cac18..c715664a 100644 --- a/src/danog/MadelineProto/Stream/Common/HashedBufferedStream.php +++ b/src/danog/MadelineProto/Stream/Common/HashedBufferedStream.php @@ -142,7 +142,7 @@ class HashedBufferedStream implements BufferedProxyStreamInterface, BufferInterf * * @throws PendingReadError Thrown if another read operation is still pending. * - * @return Generator That resolves with a string when the provided promise is resolved and the data is added to the hashing context + * @return \Generator That resolves with a string when the provided promise is resolved and the data is added to the hashing context */ public function bufferReadGenerator(int $length): \Generator { @@ -213,7 +213,7 @@ class HashedBufferedStream implements BufferedProxyStreamInterface, BufferInterf * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBufferGenerator(&$length): \Generator { @@ -228,7 +228,7 @@ class HashedBufferedStream implements BufferedProxyStreamInterface, BufferInterf * * @param int $length Length of data that is going to be written to the write buffer * - * @return Generator + * @return \Generator */ public function getWriteBufferGenerator(int $length, string $append = ''): \Generator { diff --git a/src/danog/MadelineProto/Stream/ConnectionContext.php b/src/danog/MadelineProto/Stream/ConnectionContext.php index 1d5157f2..98ad63b5 100644 --- a/src/danog/MadelineProto/Stream/ConnectionContext.php +++ b/src/danog/MadelineProto/Stream/ConnectionContext.php @@ -100,7 +100,7 @@ class ConnectionContext /** * An array of arrays containing an array with the stream name and the extra parameter to pass to it. * - * @var array> + * @var array> */ private $nextStreams = []; /** @@ -344,7 +344,7 @@ class ConnectionContext * Add a stream to the stream chain. * * @param string $streamName - * @param any $extra + * @param mixed $extra * * @return self */ @@ -357,11 +357,11 @@ class ConnectionContext /** * Set read callback, called every time the socket reads at least a byte. * - * @param callback $callable Read callback + * @param callable $callable Read callback * * @return void */ - public function setReadCallback($callable) + public function setReadCallback(callable $callable) { $this->readCallback = $callable; } @@ -379,7 +379,7 @@ class ConnectionContext * * @return callable */ - public function getReadCallback() + public function getReadCallback(): callable { return $this->readCallback; } diff --git a/src/danog/MadelineProto/Stream/MTProtoTransport/AbridgedStream.php b/src/danog/MadelineProto/Stream/MTProtoTransport/AbridgedStream.php index 9062bb40..5a429a10 100644 --- a/src/danog/MadelineProto/Stream/MTProtoTransport/AbridgedStream.php +++ b/src/danog/MadelineProto/Stream/MTProtoTransport/AbridgedStream.php @@ -80,7 +80,7 @@ class AbridgedStream implements BufferedStreamInterface, MTProtoBufferInterface * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBufferGenerator(&$length): \Generator { diff --git a/src/danog/MadelineProto/Stream/MTProtoTransport/FullStream.php b/src/danog/MadelineProto/Stream/MTProtoTransport/FullStream.php index e2d5adcf..68edd899 100644 --- a/src/danog/MadelineProto/Stream/MTProtoTransport/FullStream.php +++ b/src/danog/MadelineProto/Stream/MTProtoTransport/FullStream.php @@ -70,7 +70,7 @@ class FullStream implements BufferedStreamInterface, MTProtoBufferInterface * * @param int $length Length of data that is going to be written to the write buffer * - * @return Generator + * @return \Generator */ public function getWriteBufferGenerator(int $length, string $append = ''): \Generator { @@ -86,7 +86,7 @@ class FullStream implements BufferedStreamInterface, MTProtoBufferInterface * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBufferGenerator(&$length): \Generator { diff --git a/src/danog/MadelineProto/Stream/MTProtoTransport/HttpStream.php b/src/danog/MadelineProto/Stream/MTProtoTransport/HttpStream.php index d0840ad5..1c6eba7b 100644 --- a/src/danog/MadelineProto/Stream/MTProtoTransport/HttpStream.php +++ b/src/danog/MadelineProto/Stream/MTProtoTransport/HttpStream.php @@ -85,7 +85,7 @@ class HttpStream implements MTProtoBufferInterface, BufferedProxyStreamInterface * * @param int $length Length of data that is going to be written to the write buffer * - * @return Generator + * @return \Generator */ public function getWriteBufferGenerator(int $length, string $append = ''): \Generator { @@ -99,7 +99,7 @@ class HttpStream implements MTProtoBufferInterface, BufferedProxyStreamInterface * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBufferGenerator(&$length): \Generator { diff --git a/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediatePaddedStream.php b/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediatePaddedStream.php index 8a17a2f7..1f45e76b 100644 --- a/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediatePaddedStream.php +++ b/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediatePaddedStream.php @@ -63,7 +63,7 @@ class IntermediatePaddedStream implements BufferedStreamInterface, MTProtoBuffer * * @param int $length Length of data that is going to be written to the write buffer * - * @return Generator + * @return \Generator */ public function getWriteBufferGenerator(int $length, string $append = ''): \Generator { @@ -77,7 +77,7 @@ class IntermediatePaddedStream implements BufferedStreamInterface, MTProtoBuffer * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBufferGenerator(&$length): \Generator { diff --git a/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediateStream.php b/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediateStream.php index cefe14f8..e9555c58 100644 --- a/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediateStream.php +++ b/src/danog/MadelineProto/Stream/MTProtoTransport/IntermediateStream.php @@ -63,7 +63,7 @@ class IntermediateStream implements BufferedStreamInterface, MTProtoBufferInterf * * @param int $length Length of data that is going to be written to the write buffer * - * @return Generator + * @return \Generator */ public function getWriteBufferGenerator(int $length, string $append = ''): \Generator { @@ -76,7 +76,7 @@ class IntermediateStream implements BufferedStreamInterface, MTProtoBufferInterf * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBufferGenerator(&$length): \Generator { diff --git a/src/danog/MadelineProto/Stream/Proxy/HttpProxy.php b/src/danog/MadelineProto/Stream/Proxy/HttpProxy.php index 38143b06..ebffbbc1 100644 --- a/src/danog/MadelineProto/Stream/Proxy/HttpProxy.php +++ b/src/danog/MadelineProto/Stream/Proxy/HttpProxy.php @@ -141,7 +141,7 @@ class HttpProxy implements RawProxyStreamInterface, BufferedProxyStreamInterface * * @param int $length Length of data that is going to be written to the write buffer * - * @return Generator + * @return \Generator */ public function getWriteBuffer(int $length, string $append = ''): Promise { @@ -152,7 +152,7 @@ class HttpProxy implements RawProxyStreamInterface, BufferedProxyStreamInterface * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBuffer(&$length): Promise { diff --git a/src/danog/MadelineProto/Stream/Proxy/SocksProxy.php b/src/danog/MadelineProto/Stream/Proxy/SocksProxy.php index c265142c..214931a4 100644 --- a/src/danog/MadelineProto/Stream/Proxy/SocksProxy.php +++ b/src/danog/MadelineProto/Stream/Proxy/SocksProxy.php @@ -148,7 +148,7 @@ class SocksProxy implements RawProxyStreamInterface, BufferedProxyStreamInterfac * * @param int $length Length of data that is going to be written to the write buffer * - * @return Generator + * @return \Generator */ public function getWriteBuffer(int $length, string $append = ''): Promise { @@ -159,7 +159,7 @@ class SocksProxy implements RawProxyStreamInterface, BufferedProxyStreamInterfac * * @param int $length Length of payload, as detected by this layer * - * @return Generator + * @return \Generator */ public function getReadBuffer(&$length): Promise { diff --git a/src/danog/MadelineProto/Stream/Transport/DefaultStream.php b/src/danog/MadelineProto/Stream/Transport/DefaultStream.php index fe5423e1..751b11ae 100644 --- a/src/danog/MadelineProto/Stream/Transport/DefaultStream.php +++ b/src/danog/MadelineProto/Stream/Transport/DefaultStream.php @@ -23,6 +23,7 @@ use Amp\ByteStream\ClosedException; use Amp\CancellationToken; use Amp\Promise; use Amp\Socket\ClientTlsContext; +use Amp\Socket\Connector; use Amp\Socket\EncryptableSocket; use Amp\Socket\Socket; use danog\MadelineProto\Stream\Async\RawStream; diff --git a/src/danog/MadelineProto/Stream/Transport/PremadeStream.php b/src/danog/MadelineProto/Stream/Transport/PremadeStream.php index b21b4528..72837b96 100644 --- a/src/danog/MadelineProto/Stream/Transport/PremadeStream.php +++ b/src/danog/MadelineProto/Stream/Transport/PremadeStream.php @@ -82,7 +82,7 @@ class PremadeStream implements RawStreamInterface, ProxyStreamInterface /** * Async close. * - * @return Generator + * @return \Generator */ public function disconnect() { diff --git a/src/danog/MadelineProto/Stream/Transport/WsStream.php b/src/danog/MadelineProto/Stream/Transport/WsStream.php index f075106e..24f5aa64 100644 --- a/src/danog/MadelineProto/Stream/Transport/WsStream.php +++ b/src/danog/MadelineProto/Stream/Transport/WsStream.php @@ -21,8 +21,10 @@ namespace danog\MadelineProto\Stream\Transport; use Amp\Promise; use Amp\Socket\EncryptableSocket; +use Amp\Websocket\Client\Connection; use Amp\Websocket\Client\Connector; use Amp\Websocket\Client\Handshake; +use Amp\Websocket\Message; use danog\MadelineProto\Stream\Async\RawStream; use danog\MadelineProto\Stream\ConnectionContext; use danog\MadelineProto\Stream\ProxyStreamInterface; diff --git a/src/danog/MadelineProto/TL/Conversion/BotAPIFiles.php b/src/danog/MadelineProto/TL/Conversion/BotAPIFiles.php index df5ea393..0922c631 100644 --- a/src/danog/MadelineProto/TL/Conversion/BotAPIFiles.php +++ b/src/danog/MadelineProto/TL/Conversion/BotAPIFiles.php @@ -85,7 +85,7 @@ trait BotAPIFiles $this->logger("Got file ID with version {$fileId->getVersion()}.{$fileId->getSubVersion()}"); if (!\in_array($fileId->getVersion(), [2, 4])) { - throw new Exception("Invalid bot API file ID version {$version}"); + throw new Exception("Invalid bot API file ID version {$fileId->getVersion()}"); } $photoSize = $fileId->hasPhotoSizeSource() ? $fileId->getPhotoSizeSource() : null; diff --git a/src/danog/MadelineProto/TL/Conversion/TD.php b/src/danog/MadelineProto/TL/Conversion/TD.php index 9bb47482..a54c87df 100644 --- a/src/danog/MadelineProto/TL/Conversion/TD.php +++ b/src/danog/MadelineProto/TL/Conversion/TD.php @@ -58,7 +58,7 @@ trait TD */ public function tdToMTProto(array $params): \Generator { - $newparams = ['_' => self::REVERSE[$params['_']]]; + $newparams = ['_' => self::TD_REVERSE[$params['_']]]; foreach (self::TD_PARAMS_CONVERSION[$newparams['_']] as $td => $mtproto) { if (\is_array($mtproto)) { switch (\end($mtproto)) { diff --git a/src/danog/MadelineProto/TON/ADNLConnection.php b/src/danog/MadelineProto/TON/ADNLConnection.php index 02dff18e..f0da4f94 100644 --- a/src/danog/MadelineProto/TON/ADNLConnection.php +++ b/src/danog/MadelineProto/TON/ADNLConnection.php @@ -28,6 +28,7 @@ use danog\MadelineProto\Stream\Common\BufferedRawStream; use danog\MadelineProto\Stream\Common\CtrStream; use danog\MadelineProto\Stream\Common\HashedBufferedStream; use danog\MadelineProto\Stream\ConnectionContext; +use danog\MadelineProto\Stream\StreamInterface; use danog\MadelineProto\Stream\Transport\DefaultStream; use danog\MadelineProto\TL\TL; use danog\MadelineProto\Tools; diff --git a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php index c0bde324..b0276807 100644 --- a/src/danog/MadelineProto/VoIP/AuthKeyHandler.php +++ b/src/danog/MadelineProto/VoIP/AuthKeyHandler.php @@ -177,12 +177,12 @@ trait AuthKeyHandler $res = (yield from $this->methodCallAsyncRead('phone.confirmCall', ['key_fingerprint' => \substr(\sha1($key, true), -8), 'peer' => ['id' => $params['id'], 'access_hash' => $params['access_hash'], '_' => 'inputPhoneCall'], 'g_a' => $this->calls[$params['id']]->storage['g_a'], 'protocol' => ['_' => 'phoneCallProtocol', 'udp_reflector' => true, 'min_layer' => 65, 'max_layer' => \danog\MadelineProto\VoIP::getConnectionMaxLayer()]], ['datacenter' => $this->datacenter->curdc]))['phone_call']; } catch (\danog\MadelineProto\RPCErrorException $e) { if ($e->rpc === 'CALL_ALREADY_ACCEPTED') { - $this->logger->logger(\sprintf(\danog\MadelineProto\Lang::$current_lang['call_already_accepted'], $call['id'])); + $this->logger->logger(\sprintf(\danog\MadelineProto\Lang::$current_lang['call_already_accepted'], $params['id'])); return true; } if ($e->rpc === 'CALL_ALREADY_DECLINED') { $this->logger->logger(\danog\MadelineProto\Lang::$current_lang['call_already_declined']); - yield from $this->discardCall($call['id'], ['_' => 'phoneCallDiscardReasonHangup']); + yield from $this->discardCall($params['id'], ['_' => 'phoneCallDiscardReasonHangup']); return false; } throw $e; diff --git a/src/danog/MadelineProto/Wrappers/Loop.php b/src/danog/MadelineProto/Wrappers/Loop.php index 85ddc035..1c5e5d34 100644 --- a/src/danog/MadelineProto/Wrappers/Loop.php +++ b/src/danog/MadelineProto/Wrappers/Loop.php @@ -61,7 +61,7 @@ trait Loop return false; } $this->logger->logger('Starting event loop'); - if (!\is_callable($this->loop_callback) || \is_array($this->loop_callback) && $this->loop_callback[1] === 'onLoop' && !\method_exists(...$this->loop_callback)) { + if (!\is_callable($this->loop_callback)) { $this->loop_callback = null; } static $inited = false;