1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 04:08:59 +01:00
This commit is contained in:
Daniil Gentili 2024-04-19 15:35:02 +02:00
parent b9513ac4a6
commit 2a80498542
4 changed files with 62 additions and 85 deletions

View File

@ -611,9 +611,6 @@
<UnresolvableInclude>
<code><![CDATA[require $file]]></code>
</UnresolvableInclude>
<UnsafeInstantiation>
<code><![CDATA[new $class]]></code>
</UnsafeInstantiation>
</file>
<file src="src/EventHandler/AbstractMessage.php">
<InvalidReturnStatement>
@ -2231,77 +2228,6 @@
<code><![CDATA[$id]]></code>
</TypeDoesNotContainType>
</file>
<file src="src/InternalDoc.php">
<InvalidReturnStatement>
<code><![CDATA[$this->wrapper->getAPI()->getEventHandler($class)]]></code>
</InvalidReturnStatement>
<InvalidReturnType>
<code><![CDATA[T|EventHandlerProxy|__PHP_Incomplete_Class|null]]></code>
</InvalidReturnType>
<MissingParamType>
<code><![CDATA[$data]]></code>
</MissingParamType>
<MixedReturnStatement>
<code><![CDATA[$this->wrapper->getAPI()->downloadToDir($messageMedia, $dir, $cb, $cancellation)]]></code>
<code><![CDATA[$this->wrapper->getAPI()->downloadToDir($messageMedia, $dir, $cb, $cancellation)]]></code>
<code><![CDATA[$this->wrapper->getAPI()->downloadToFile($messageMedia, $file, $cb, $cancellation)]]></code>
<code><![CDATA[$this->wrapper->getAPI()->downloadToFile($messageMedia, $file, $cb, $cancellation)]]></code>
<code><![CDATA[$this->wrapper->getAPI()->uploadFromCallable($callable, $size, $mime, $fileName, $cb, $seekable, $encrypted, $cancellation)]]></code>
<code><![CDATA[$this->wrapper->getAPI()->uploadFromCallable($callable, $size, $mime, $fileName, $cb, $seekable, $encrypted, $cancellation)]]></code>
<code><![CDATA[$this->wrapper->getAPI()->uploadFromTgfile($media, $cb, $encrypted, $cancellation)]]></code>
<code><![CDATA[$this->wrapper->getAPI()->uploadFromTgfile($media, $cb, $encrypted, $cancellation)]]></code>
<code><![CDATA[$this->wrapper->getAPI()->uploadFromUrl($url, $size, $fileName, $cb, $encrypted, $cancellation)]]></code>
<code><![CDATA[$this->wrapper->getAPI()->uploadFromUrl($url, $size, $fileName, $cb, $encrypted, $cancellation)]]></code>
</MixedReturnStatement>
<PossiblyInvalidPropertyAssignmentValue>
<code><![CDATA[$this->account ??= new \danog\MadelineProto\Namespace\AbstractAPI('account')]]></code>
<code><![CDATA[$this->auth ??= new \danog\MadelineProto\Namespace\AbstractAPI('auth')]]></code>
<code><![CDATA[$this->bots ??= new \danog\MadelineProto\Namespace\AbstractAPI('bots')]]></code>
<code><![CDATA[$this->channels ??= new \danog\MadelineProto\Namespace\AbstractAPI('channels')]]></code>
<code><![CDATA[$this->chatlists ??= new \danog\MadelineProto\Namespace\AbstractAPI('chatlists')]]></code>
<code><![CDATA[$this->contacts ??= new \danog\MadelineProto\Namespace\AbstractAPI('contacts')]]></code>
<code><![CDATA[$this->folders ??= new \danog\MadelineProto\Namespace\AbstractAPI('folders')]]></code>
<code><![CDATA[$this->fragment ??= new \danog\MadelineProto\Namespace\AbstractAPI('fragment')]]></code>
<code><![CDATA[$this->help ??= new \danog\MadelineProto\Namespace\AbstractAPI('help')]]></code>
<code><![CDATA[$this->langpack ??= new \danog\MadelineProto\Namespace\AbstractAPI('langpack')]]></code>
<code><![CDATA[$this->messages ??= new \danog\MadelineProto\Namespace\AbstractAPI('messages')]]></code>
<code><![CDATA[$this->payments ??= new \danog\MadelineProto\Namespace\AbstractAPI('payments')]]></code>
<code><![CDATA[$this->phone ??= new \danog\MadelineProto\Namespace\AbstractAPI('phone')]]></code>
<code><![CDATA[$this->photos ??= new \danog\MadelineProto\Namespace\AbstractAPI('photos')]]></code>
<code><![CDATA[$this->premium ??= new \danog\MadelineProto\Namespace\AbstractAPI('premium')]]></code>
<code><![CDATA[$this->smsjobs ??= new \danog\MadelineProto\Namespace\AbstractAPI('smsjobs')]]></code>
<code><![CDATA[$this->stats ??= new \danog\MadelineProto\Namespace\AbstractAPI('stats')]]></code>
<code><![CDATA[$this->stickers ??= new \danog\MadelineProto\Namespace\AbstractAPI('stickers')]]></code>
<code><![CDATA[$this->stories ??= new \danog\MadelineProto\Namespace\AbstractAPI('stories')]]></code>
<code><![CDATA[$this->updates ??= new \danog\MadelineProto\Namespace\AbstractAPI('updates')]]></code>
<code><![CDATA[$this->upload ??= new \danog\MadelineProto\Namespace\AbstractAPI('upload')]]></code>
<code><![CDATA[$this->users ??= new \danog\MadelineProto\Namespace\AbstractAPI('users')]]></code>
</PossiblyInvalidPropertyAssignmentValue>
<PossiblyUndefinedMethod>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
<code><![CDATA[setWrapper]]></code>
</PossiblyUndefinedMethod>
</file>
<file src="src/Ipc/Client.php">
<ArgumentTypeCoercion>
<code><![CDATA[$class]]></code>
@ -4112,18 +4038,47 @@
</file>
<file src="src/MTProtoTools/FilesAbstraction.php">
<MixedArgument>
<code><![CDATA[$attributesOrig['thumbSeek']]]></code>
<code><![CDATA[$attributesOrig['thumbSeek']]]></code>
<code><![CDATA[$this->methodCallAsyncRead(
$method,
$params
)]]></code>
</MixedArgument>
<MixedArrayAccess>
<code><![CDATA[$attributes[0]['duration']]]></code>
<code><![CDATA[$attributes[0]['duration']]]></code>
<code><![CDATA[$attributes[0]['duration']]]></code>
<code><![CDATA[$attributes[0]['h']]]></code>
<code><![CDATA[$attributes[0]['h']]]></code>
<code><![CDATA[$attributes[0]['no_sound']]]></code>
<code><![CDATA[$attributes[0]['performer']]]></code>
<code><![CDATA[$attributes[0]['title']]]></code>
<code><![CDATA[$attributes[0]['w']]]></code>
</MixedArrayAccess>
<MixedArrayAssignment>
<code><![CDATA[$attributes[0]['duration']]]></code>
<code><![CDATA[$attributes[0]['duration']]]></code>
<code><![CDATA[$attributes[0]['h']]]></code>
<code><![CDATA[$attributes[0]['performer']]]></code>
<code><![CDATA[$attributes[0]['title']]]></code>
<code><![CDATA[$attributes[0]['w']]]></code>
</MixedArrayAssignment>
<MixedAssignment>
<code><![CDATA[$attributes[0]['duration']]]></code>
<code><![CDATA[$attributes[0]['duration']]]></code>
<code><![CDATA[$attributes[0]['h']]]></code>
<code><![CDATA[$attributes[0]['performer']]]></code>
<code><![CDATA[$attributes[0]['title']]]></code>
<code><![CDATA[$attributes[0]['w']]]></code>
<code><![CDATA[$message['media']['iv']]]></code>
<code><![CDATA[$message['media']['iv']]]></code>
<code><![CDATA[$message['media']['key']]]></code>
<code><![CDATA[$message['media']['key']]]></code>
<code><![CDATA[$message['media']['size']]]></code>
<code><![CDATA[$message['media']['size']]]></code>
<code><![CDATA[$thumb]]></code>
<code><![CDATA[$thumb]]></code>
</MixedAssignment>
<MoreSpecificReturnType>
<code><![CDATA[Message]]></code>
@ -4134,6 +4089,19 @@
<code><![CDATA[$media['file']]]></code>
<code><![CDATA[$media['file']]]></code>
</PossiblyInvalidArgument>
<PossiblyNullArgument>
<code><![CDATA[$stderr]]></code>
<code><![CDATA[$stderr]]></code>
<code><![CDATA[$stderr]]></code>
<code><![CDATA[$stderr]]></code>
</PossiblyNullArgument>
<RedundantConditionGivenDocblockType>
<code><![CDATA[\is_array($media['file'])]]></code>
</RedundantConditionGivenDocblockType>
<ReferenceConstraintViolation>
<code><![CDATA[$file]]></code>
<code><![CDATA[$file]]></code>
</ReferenceConstraintViolation>
</file>
<file src="src/MTProtoTools/FilesLogic.php">
<MissingClosureReturnType>
@ -4180,13 +4148,9 @@
<code><![CDATA[$file]]></code>
</PossiblyInvalidArgument>
<PossiblyNullArgument>
<code><![CDATA[$_SERVER['REQUEST_METHOD']]]></code>
<code><![CDATA[$body]]></code>
<code><![CDATA[$size]]></code>
</PossiblyNullArgument>
<PossiblyUndefinedArrayOffset>
<code><![CDATA[$_SERVER['REQUEST_METHOD']]]></code>
</PossiblyUndefinedArrayOffset>
<PossiblyUndefinedMethod>
<code><![CDATA[seek]]></code>
<code><![CDATA[seek]]></code>
@ -5147,6 +5111,14 @@
<RedundantConditionGivenDocblockType>
<code><![CDATA[$timeout !== null]]></code>
</RedundantConditionGivenDocblockType>
<TypeDoesNotContainType>
<code><![CDATA[$update['_'] === 'updateNewScheduledMessage']]></code>
<code><![CDATA[$update['_'] === 'updateNewScheduledMessage']]></code>
<code><![CDATA[$update['_'] === 'updateNewScheduledMessage']]></code>
<code><![CDATA[$update['_'] === 'updateNewScheduledMessage']]></code>
<code><![CDATA[$update['_'] === 'updateNewScheduledMessage']]></code>
<code><![CDATA[$update['_'] === 'updateNewScheduledMessage']]></code>
</TypeDoesNotContainType>
</file>
<file src="src/MTProtoTools/UpdatesState.php">
<MixedOperand>
@ -6433,6 +6405,14 @@
<code><![CDATA[ClosedException]]></code>
</UndefinedClass>
</file>
<file src="src/StreamDuplicator.php">
<MissingTemplateParam>
<code><![CDATA[IteratorAggregate]]></code>
</MissingTemplateParam>
<PropertyTypeCoercion>
<code><![CDATA[$outputs]]></code>
</PropertyTypeCoercion>
</file>
<file src="src/TL/Conversion/BotAPI.php">
<MissingParamType>
<code><![CDATA[$markup]]></code>
@ -7909,9 +7889,6 @@
<code><![CDATA[$this->pluginInstances[$class]]]></code>
<code><![CDATA[$this->pluginInstances[$class]]]></code>
</PossiblyInvalidArrayOffset>
<UnsafeInstantiation>
<code><![CDATA[new $class_name]]></code>
</UnsafeInstantiation>
</file>
<file src="src/Wrappers/Login.php">
<InvalidFalsableReturnType>

View File

@ -2120,7 +2120,7 @@ abstract class InternalDoc
/**
* Upload file.
*
* @param FileCallbackInterface|LocalFile|RemoteUrl|BotApiFileId|string|array|resource $file File, URL or Telegram file to upload
* @param FileCallbackInterface|LocalFile|RemoteUrl|BotApiFileId|ReadableStream|string|array|resource $file File, URL or Telegram file to upload
* @param string $fileName File name
* @param callable $cb Callback
* @param boolean $encrypted Whether to encrypt file for secret chats

View File

@ -1047,10 +1047,10 @@ trait FilesAbstraction
}
$p->getSink()->close();
$p->getSource()->close();
unset($p);
$mimeType ??= (new finfo())->buffer($buff, FILEINFO_MIME_TYPE);
});
unset($p);
}
$fileFuture = async(fn () => $this->upload(new StreamDuplicator($file, ...$streams), $fileName ?? '', $callback, cancellation: $cancellation));
@ -1116,10 +1116,10 @@ trait FilesAbstraction
}
$p->getSink()->close();
$p->getSource()->close();
unset($p);
$mimeType ??= (new finfo())->buffer($buff, FILEINFO_MIME_TYPE);
});
unset($p);
}
$fileFuture = async(fn () => $this->upload(new StreamDuplicator($file, ...$streams), $fileName ?? '', $callback, cancellation: $cancellation));

View File

@ -302,7 +302,7 @@ trait FilesLogic
/**
* Upload file.
*
* @param FileCallbackInterface|LocalFile|RemoteUrl|BotApiFileId|string|array|resource $file File, URL or Telegram file to upload
* @param FileCallbackInterface|LocalFile|RemoteUrl|BotApiFileId|ReadableStream|string|array|resource $file File, URL or Telegram file to upload
* @param string $fileName File name
* @param callable $cb Callback
* @param boolean $encrypted Whether to encrypt file for secret chats