diff --git a/psalm.xml b/psalm.xml index 3c327d44e..2ae5ec7ae 100644 --- a/psalm.xml +++ b/psalm.xml @@ -19,6 +19,7 @@ + diff --git a/src/RPCError/FileReference*Error.php b/src/RPCError/FileReference*Error.php deleted file mode 100644 index aa6e6a10d..000000000 --- a/src/RPCError/FileReference*Error.php +++ /dev/null @@ -1,30 +0,0 @@ -. - * - * @author Daniil Gentili - * @copyright 2016-2024 Daniil Gentili - * @license https://opensource.org/licenses/AGPL-3.0 AGPLv3 - * @link https://docs.madelineproto.xyz MadelineProto documentation - */ - -namespace danog\MadelineProto\RPCError; - -use danog\MadelineProto\RPCErrorException; - -/** - * The file reference expired, it [must be refreshed](https://core.telegram.org/api/file_reference). - */ -final class FileReference*Error extends RPCErrorException -{ - public function __construct(string $caller, ?\Exception $previous = null) { - parent::__construct('FILE_REFERENCE_*', 400, $caller, $previous); - } -} \ No newline at end of file diff --git a/src/RPCErrorException.php b/src/RPCErrorException.php index f980bd417..4e5b30362 100644 --- a/src/RPCErrorException.php +++ b/src/RPCErrorException.php @@ -216,7 +216,7 @@ class RPCErrorException extends \Exception ?\Exception $previous = null ): self { // Start match - match ($rpc) { + return match ($rpc) { 'ABOUT_TOO_LONG' => new \danog\MadelineProto\RPCError\AboutTooLongError($caller, $previous), 'ACCESS_TOKEN_EXPIRED' => new \danog\MadelineProto\RPCError\AccessTokenExpiredError($caller, $previous), 'ACCESS_TOKEN_INVALID' => new \danog\MadelineProto\RPCError\AccessTokenInvalidError($caller, $previous), diff --git a/src/TL/PrettyException.php b/src/TL/PrettyException.php index 760c7b19a..ca60d7d51 100644 --- a/src/TL/PrettyException.php +++ b/src/TL/PrettyException.php @@ -58,7 +58,7 @@ trait PrettyException * @param string $init Method name * @param array $trace Async trace */ - public function prettifyTL(string $init, ?array $trace = null): void + public function prettifyTL(string $init = '', ?array $trace = null): void { $this->method = $init; $previous_trace = $this->tlTrace; diff --git a/tools/build_docs.php b/tools/build_docs.php index e58e172c5..7be1c6877 100755 --- a/tools/build_docs.php +++ b/tools/build_docs.php @@ -41,6 +41,9 @@ chdir($d=__DIR__.'/..'); require 'vendor/autoload.php'; +`rm -r src/RPCError/*`; +`git checkout src/RPCError/FloodWaitError.php`; + $map = []; $year = date('Y'); @@ -98,7 +101,7 @@ foreach ($errors['result'] as $code => $sub) { $err = file_get_contents('src/RPCErrorException.php'); $err = preg_replace_callback('|// Start match.*// End match|sim', static function ($matches) use ($map) { - $data = "match (\$rpc) {\n"; + $data = "return match (\$rpc) {\n"; foreach ($map as $err => [$human, $code, $class]) { $data .= "$err => new $class(\$caller, \$previous),\n"; }