1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-26 19:24:42 +01:00

Psalm fixes

This commit is contained in:
Daniil Gentili 2024-04-15 22:03:06 +02:00
parent b343265b32
commit 27e4c750b9
8 changed files with 6390 additions and 881 deletions

View File

@ -28,3 +28,15 @@ steps:
commands: commands:
- apk add bash - apk add bash
- tests/test.sh cs - tests/test.sh cs
psalm:
group: test
image: danog/madelineproto:next
when:
event:
- pull_request
- tag
- push
commands:
- apk add bash
- tests/test.sh psalm

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?> <?xml version="1.0"?>
<psalm <psalm
errorLevel="2" errorLevel="1"
resolveFromConfigFile="true" resolveFromConfigFile="true"
findUnusedCode="false" findUnusedCode="false"
findUnusedBaselineEntry="false" findUnusedBaselineEntry="false"

View File

@ -57,7 +57,7 @@ final class ExitFailure
$this->props = $props; $this->props = $props;
} }
public function getException(): object public function getException(): \Throwable
{ {
$prev = new MadelineProtoException("Client backtrace"); $prev = new MadelineProtoException("Client backtrace");

View File

@ -1550,6 +1550,7 @@ If you intentionally deleted this account, ignore this message.',
]; ];
// THIS WILL BE OVERWRITTEN BY $lang["en"] // THIS WILL BE OVERWRITTEN BY $lang["en"]
/** @var array<string, string> */
public static array $current_lang = [ public static array $current_lang = [
'2fa_uncalled' => 'I\'m not waiting for the password! Please call the phoneLogin and the completePhoneLogin methods first!', '2fa_uncalled' => 'I\'m not waiting for the password! Please call the phoneLogin and the completePhoneLogin methods first!',
'accepting_call' => 'Accepting call from %s...', 'accepting_call' => 'Accepting call from %s...',

View File

@ -22,7 +22,7 @@ namespace danog\MadelineProto\Loop\Connection;
use Amp\ByteStream\PendingReadError; use Amp\ByteStream\PendingReadError;
use Amp\ByteStream\StreamException; use Amp\ByteStream\StreamException;
use Amp\Websocket\ClosedException; use Amp\Websocket\WebsocketClosedException;
use danog\Loop\Loop; use danog\Loop\Loop;
use danog\MadelineProto\Logger; use danog\MadelineProto\Logger;
use danog\MadelineProto\MTProto\MTProtoIncomingMessage; use danog\MadelineProto\MTProto\MTProtoIncomingMessage;
@ -130,7 +130,7 @@ final class ReadLoop extends Loop
} }
try { try {
$buffer = $this->connection->stream->getReadBuffer($payload_length); $buffer = $this->connection->stream->getReadBuffer($payload_length);
} catch (ClosedException $e) { } catch (WebsocketClosedException $e) {
$this->API->logger($e->getReason()); $this->API->logger($e->getReason());
if (str_starts_with($e->getReason(), ' ')) { if (str_starts_with($e->getReason(), ' ')) {
$payload = -((int) substr($e->getReason(), 7)); $payload = -((int) substr($e->getReason(), 7));

View File

@ -543,6 +543,7 @@ final class Ogg
} }
} }
} }
\assert(isset($opus));
$checkErr = static function (int|CData $err) use ($opus): void { $checkErr = static function (int|CData $err) use ($opus): void {
if ($err instanceof CData) { if ($err instanceof CData) {
$err = $err->cdata; $err = $err->cdata;

View File

@ -34,6 +34,7 @@ final class Lang
public static array $lang = %s; public static array $lang = %s;
// THIS WILL BE OVERWRITTEN BY $lang["en"] // THIS WILL BE OVERWRITTEN BY $lang["en"]
/** @var array<string, string> */
public static array $current_lang = %s; public static array $current_lang = %s;
}'; }';