Skip to content

Commit

Permalink
Fix psalm
Browse files Browse the repository at this point in the history
  • Loading branch information
danog committed Sep 11, 2023
1 parent 554cef3 commit 6c5022a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/Conversion.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ final class Conversion
*
* @param array<int, string> $authorization Authorization info
*/
public static function importAuthorization(array $authorization, int $main_dc_id, string $session, ?SettingsAbstract $settings = null): API
public static function importAuthorization(array $authorization, int $main_dc_id, string $session, ?Settings $settings = null): API
{
$settingsFull = new Settings;
if ($settings) {
Expand All @@ -50,7 +50,7 @@ public static function importAuthorization(array $authorization, int $main_dc_id
$MadelineProto->importAuthorization($authorization, $main_dc_id);
return $MadelineProto;
}
public static function telethon(string $session, string $new_session, ?SettingsAbstract $settings = null)
public static function telethon(string $session, string $new_session, ?Settings $settings = null)
{
if (!\extension_loaded('sqlite3')) {
throw Exception::extension('sqlite3');
Expand All @@ -73,7 +73,7 @@ public static function telethon(string $session, string $new_session, ?SettingsA
return self::importAuthorization($dcs, $dc['dc_id'], $new_session, $settings);
}

public static function pyrogram(string $session, string $new_session, ?SettingsAbstract $settings = null)
public static function pyrogram(string $session, string $new_session, ?Settings $settings = null)
{
\set_error_handler(['\\danog\\MadelineProto\\Exception', 'ExceptionErrorHandler']);
if (!isset(\pathinfo($session)['extension'])) {
Expand All @@ -85,7 +85,8 @@ public static function pyrogram(string $session, string $new_session, ?SettingsA
Assert::notFalse($session['auth_key']);
Assert::integer($session['dc_id']);

$settings['connection_settings']['all']['test_mode'] = $session['test_mode'];
$settings ??= new Settings;
$settings->getConnection()->setTestMode($session['test_mode']);

return self::importAuthorization([$session['dc_id'] => $session['auth_key']], $session['dc_id'], $new_session, $settings);
}
Expand Down

0 comments on commit 6c5022a

Please sign in to comment.