1
0
mirror of https://github.com/danog/MadelineProto.git synced 2024-11-30 07:18:57 +01:00

Psalm fixes

This commit is contained in:
Daniil Gentili 2024-04-27 15:06:59 +02:00
parent 5d0f02d031
commit 02b6f8d365
3 changed files with 29 additions and 7 deletions

View File

@ -530,7 +530,6 @@ Want to add your own open-source project to this list? [Click here!](https://doc
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getDhConfig" name="getDhConfig">Get diffie-hellman configuration: getDhConfig</a> * <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getDhConfig" name="getDhConfig">Get diffie-hellman configuration: getDhConfig</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDiscussionMessage.html" name="messages.getDiscussionMessage">Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group: messages.getDiscussionMessage</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDiscussionMessage.html" name="messages.getDiscussionMessage">Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group: messages.getDiscussionMessage</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getDownloadInfo" name="getDownloadInfo">Get download info of file: getDownloadInfo</a> * <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getDownloadInfo" name="getDownloadInfo">Get download info of file: getDownloadInfo</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getPropicInfo" name="getPropicInfo">Get download info of the propic of a user: getPropicInfo</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getDownloadLink" name="getDownloadLink">Get download link of media file: getDownloadLink</a> * <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getDownloadLink" name="getDownloadLink">Get download link of media file: getDownloadLink</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getEventHandler" name="getEventHandler">Get event handler (or plugin instance): getEventHandler</a> * <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getEventHandler" name="getEventHandler">Get event handler (or plugin instance): getEventHandler</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getExtensionFromLocation" name="getExtensionFromLocation">Get extension from file location: getExtensionFromLocation</a> * <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getExtensionFromLocation" name="getExtensionFromLocation">Get extension from file location: getExtensionFromLocation</a>
@ -644,6 +643,7 @@ Want to add your own open-source project to this list? [Click here!](https://doc
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getSecretMessage" name="getSecretMessage">Gets a secret chat message: getSecretMessage</a> * <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getSecretMessage" name="getSecretMessage">Gets a secret chat message: getSecretMessage</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getNotifySettings.html" name="account.getNotifySettings">Gets current notification settings for a given user/group, from all users/all groups: account.getNotifySettings</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/account.getNotifySettings.html" name="account.getNotifySettings">Gets current notification settings for a given user/group, from all users/all groups: account.getNotifySettings</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getFeaturedEmojiStickers.html" name="messages.getFeaturedEmojiStickers">Gets featured custom emoji stickersets: messages.getFeaturedEmojiStickers</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getFeaturedEmojiStickers.html" name="messages.getFeaturedEmojiStickers">Gets featured custom emoji stickersets: messages.getFeaturedEmojiStickers</a>
* <a href="https://docs.madelineproto.xyz/PHP/danog/MadelineProto/API.html#getPropicInfo" name="getPropicInfo">Gets info of the propic of a user: getPropicInfo</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/premium.getBoostsStatus.html" name="premium.getBoostsStatus">Gets the current number of boosts of a channel: premium.getBoostsStatus</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/premium.getBoostsStatus.html" name="premium.getBoostsStatus">Gets the current number of boosts of a channel: premium.getBoostsStatus</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDefaultHistoryTTL.html" name="messages.getDefaultHistoryTTL">Gets the default value of the Time-To-Live setting, applied to all new chats: messages.getDefaultHistoryTTL</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getDefaultHistoryTTL.html" name="messages.getDefaultHistoryTTL">Gets the default value of the Time-To-Live setting, applied to all new chats: messages.getDefaultHistoryTTL</a>
* <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getEmojiStickers.html" name="messages.getEmojiStickers">Gets the list of currently installed custom emoji stickersets: messages.getEmojiStickers</a> * <a href="https://docs.madelineproto.xyz/API_docs/methods/messages.getEmojiStickers.html" name="messages.getEmojiStickers">Gets the list of currently installed custom emoji stickersets: messages.getEmojiStickers</a>

View File

@ -119,6 +119,11 @@
<code><![CDATA[\is_callable($callable)]]></code> <code><![CDATA[\is_callable($callable)]]></code>
</RedundantConditionGivenDocblockType> </RedundantConditionGivenDocblockType>
</file> </file>
<file src="src/BotApiFileId.php">
<DocblockTypeContradiction>
<code><![CDATA[$size <= 0]]></code>
</DocblockTypeContradiction>
</file>
<file src="src/Broadcast/Action/ActionForward.php"> <file src="src/Broadcast/Action/ActionForward.php">
<MixedArgument> <MixedArgument>
<code><![CDATA[$updates]]></code> <code><![CDATA[$updates]]></code>
@ -3763,7 +3768,9 @@
<code><![CDATA[$offset['offset']]]></code> <code><![CDATA[$offset['offset']]]></code>
<code><![CDATA[$offset['part_end_at'] - $offset['part_start_at']]]></code> <code><![CDATA[$offset['part_end_at'] - $offset['part_start_at']]]></code>
<code><![CDATA[$offset['part_start_at']]]></code> <code><![CDATA[$offset['part_start_at']]]></code>
<code><![CDATA[$photo]]></code>
<code><![CDATA[$res['mime'] ?? 'image/jpeg']]></code> <code><![CDATA[$res['mime'] ?? 'image/jpeg']]></code>
<code><![CDATA[$size]]></code>
<code><![CDATA[$this->methodCallAsyncRead('upload.getCdnFileHashes', ['file_token' => $file, 'offset' => $offset, 'cancellation' => $cancellation], $this->authorized_dc)]]></code> <code><![CDATA[$this->methodCallAsyncRead('upload.getCdnFileHashes', ['file_token' => $file, 'offset' => $offset, 'cancellation' => $cancellation], $this->authorized_dc)]]></code>
<code><![CDATA[$this->methodCallAsyncRead('upload.reuploadCdnFile', ['file_token' => $messageMedia['file_token'], 'request_token' => $res['request_token'], 'cancellation' => $cancellation], $this->authorized_dc)]]></code> <code><![CDATA[$this->methodCallAsyncRead('upload.reuploadCdnFile', ['file_token' => $messageMedia['file_token'], 'request_token' => $res['request_token'], 'cancellation' => $cancellation], $this->authorized_dc)]]></code>
<code><![CDATA[$url]]></code> <code><![CDATA[$url]]></code>
@ -3866,6 +3873,10 @@
<code><![CDATA[$res['encryption_iv']]]></code> <code><![CDATA[$res['encryption_iv']]]></code>
<code><![CDATA[$res['encryption_key']]]></code> <code><![CDATA[$res['encryption_key']]]></code>
<code><![CDATA[$res['file_token']]]></code> <code><![CDATA[$res['file_token']]]></code>
<code><![CDATA[$res['photo'][$big ? 'big_file_id' : 'small_file_id']]]></code>
<code><![CDATA[$res['photo'][$big ? 'big_file_size' : 'small_file_size']]]></code>
<code><![CDATA[$res['photo']['dc_id']]]></code>
<code><![CDATA[$res['photo']['id']]]></code>
<code><![CDATA[$res['request_token']]]></code> <code><![CDATA[$res['request_token']]]></code>
<code><![CDATA[$res['type']]]></code> <code><![CDATA[$res['type']]]></code>
<code><![CDATA[$res['type']]]></code> <code><![CDATA[$res['type']]]></code>
@ -3930,6 +3941,7 @@
<code><![CDATA[$messageMedia['cdn_key']]]></code> <code><![CDATA[$messageMedia['cdn_key']]]></code>
<code><![CDATA[$messageMedia['decrypted_message']['media']['file']]]></code> <code><![CDATA[$messageMedia['decrypted_message']['media']['file']]]></code>
<code><![CDATA[$messageMedia['file_token']]]></code> <code><![CDATA[$messageMedia['file_token']]]></code>
<code><![CDATA[$photo]]></code>
<code><![CDATA[$res]]></code> <code><![CDATA[$res]]></code>
<code><![CDATA[$res]]></code> <code><![CDATA[$res]]></code>
<code><![CDATA[$res]]></code> <code><![CDATA[$res]]></code>
@ -3967,6 +3979,7 @@
<code><![CDATA[$res['thumb_size']]]></code> <code><![CDATA[$res['thumb_size']]]></code>
<code><![CDATA[$res['thumb_size']]]></code> <code><![CDATA[$res['thumb_size']]]></code>
<code><![CDATA[$res['thumb_size']]]></code> <code><![CDATA[$res['thumb_size']]]></code>
<code><![CDATA[$size]]></code>
<code><![CDATA[$t]]></code> <code><![CDATA[$t]]></code>
<code><![CDATA[$url]]></code> <code><![CDATA[$url]]></code>
</MixedAssignment> </MixedAssignment>
@ -3991,6 +4004,8 @@
<code><![CDATA[$res['name']]]></code> <code><![CDATA[$res['name']]]></code>
<code><![CDATA[$res['name']]]></code> <code><![CDATA[$res['name']]]></code>
<code><![CDATA[$res['name']]]></code> <code><![CDATA[$res['name']]]></code>
<code><![CDATA[$res['photo']['dc_id']]]></code>
<code><![CDATA[$res['photo']['id']]]></code>
</MixedOperand> </MixedOperand>
<MixedPropertyTypeCoercion> <MixedPropertyTypeCoercion>
<code><![CDATA[$this->cdn_hashes]]></code> <code><![CDATA[$this->cdn_hashes]]></code>
@ -4061,7 +4076,6 @@
</TooManyArguments> </TooManyArguments>
<TypeDoesNotContainType> <TypeDoesNotContainType>
<code><![CDATA[$res['ext'] === '']]></code> <code><![CDATA[$res['ext'] === '']]></code>
<code><![CDATA[$res['ext'] === '']]></code>
</TypeDoesNotContainType> </TypeDoesNotContainType>
</file> </file>
<file src="src/MTProtoTools/FilesAbstraction.php"> <file src="src/MTProtoTools/FilesAbstraction.php">
@ -4467,6 +4481,7 @@
<code><![CDATA[$res['photo']['dc_id']]]></code> <code><![CDATA[$res['photo']['dc_id']]]></code>
<code><![CDATA[$res['photo']['id']]]></code> <code><![CDATA[$res['photo']['id']]]></code>
<code><![CDATA[$res['photo']['sizes']]]></code> <code><![CDATA[$res['photo']['sizes']]]></code>
<code><![CDATA[$size['type']]]></code>
<code><![CDATA[$total_count]]></code> <code><![CDATA[$total_count]]></code>
<code><![CDATA[$total_count]]></code> <code><![CDATA[$total_count]]></code>
<code><![CDATA[$total_count]]></code> <code><![CDATA[$total_count]]></code>
@ -4475,7 +4490,6 @@
<MixedArrayAccess> <MixedArrayAccess>
<code><![CDATA[$entity['_']]]></code> <code><![CDATA[$entity['_']]]></code>
<code><![CDATA[$entity['user_id']]]></code> <code><![CDATA[$entity['user_id']]]></code>
<code><![CDATA[$full['User']['access_hash']]]></code>
<code><![CDATA[$full['full']['chat_photo']]]></code> <code><![CDATA[$full['full']['chat_photo']]]></code>
<code><![CDATA[$full['full']['chat_photo']]]></code> <code><![CDATA[$full['full']['chat_photo']]]></code>
<code><![CDATA[$full['full']['exported_invite']]]></code> <code><![CDATA[$full['full']['exported_invite']]]></code>
@ -4524,6 +4538,8 @@
<code><![CDATA[$res['photo']['sizes']]]></code> <code><![CDATA[$res['photo']['sizes']]]></code>
<code><![CDATA[$res['photo']['sizes']]]></code> <code><![CDATA[$res['photo']['sizes']]]></code>
<code><![CDATA[$res['photo']['sizes'][0]]]></code> <code><![CDATA[$res['photo']['sizes'][0]]]></code>
<code><![CDATA[$size['size']]]></code>
<code><![CDATA[$size['type']]]></code>
<code><![CDATA[$support['user']['id']]]></code> <code><![CDATA[$support['user']['id']]]></code>
<code><![CDATA[$this->TL->getConstructors()->findByPredicate($constructor['_'])['type']]]></code> <code><![CDATA[$this->TL->getConstructors()->findByPredicate($constructor['_'])['type']]]></code>
<code><![CDATA[$this->authorization['user']['id']]]></code> <code><![CDATA[$this->authorization['user']['id']]]></code>
@ -4564,6 +4580,7 @@
<code><![CDATA[$participant]]></code> <code><![CDATA[$participant]]></code>
<code><![CDATA[$participant]]></code> <code><![CDATA[$participant]]></code>
<code><![CDATA[$participant]]></code> <code><![CDATA[$participant]]></code>
<code><![CDATA[$photo[$type.'_file_size']]]></code>
<code><![CDATA[$res[$key]]]></code> <code><![CDATA[$res[$key]]]></code>
<code><![CDATA[$res[$key]]]></code> <code><![CDATA[$res[$key]]]></code>
<code><![CDATA[$res[$key]]]></code> <code><![CDATA[$res[$key]]]></code>
@ -4639,9 +4656,6 @@
<PossiblyNullArrayOffset> <PossiblyNullArrayOffset>
<code><![CDATA[$res['participants']]]></code> <code><![CDATA[$res['participants']]]></code>
</PossiblyNullArrayOffset> </PossiblyNullArrayOffset>
<PossiblyUndefinedArrayOffset>
<code><![CDATA[$res['id']]]></code>
</PossiblyUndefinedArrayOffset>
<RedundantFunctionCall> <RedundantFunctionCall>
<code><![CDATA[array_values]]></code> <code><![CDATA[array_values]]></code>
</RedundantFunctionCall> </RedundantFunctionCall>

View File

@ -712,7 +712,7 @@ trait Files
* @param mixed $messageMedia File ID * @param mixed $messageMedia File ID
* *
* @return array{ * @return array{
* ext?: string, * ext: string,
* name: string, * name: string,
* mime: string, * mime: string,
* size: int, * size: int,
@ -731,6 +731,8 @@ trait Files
$pathinfo = pathinfo($messageMedia->fileName); $pathinfo = pathinfo($messageMedia->fileName);
if (isset($pathinfo['extension'])) { if (isset($pathinfo['extension'])) {
$res['ext'] = '.'.$pathinfo['extension']; $res['ext'] = '.'.$pathinfo['extension'];
} else {
$res['ext'] = '';
} }
$res['name'] = $pathinfo['filename']; $res['name'] = $pathinfo['filename'];
return $res; return $res;
@ -757,6 +759,8 @@ trait Files
$pathinfo = pathinfo($messageMedia['file_name']); $pathinfo = pathinfo($messageMedia['file_name']);
if (isset($pathinfo['extension'])) { if (isset($pathinfo['extension'])) {
$res['ext'] = '.'.$pathinfo['extension']; $res['ext'] = '.'.$pathinfo['extension'];
} else {
$res['ext'] = '';
} }
$res['name'] = $pathinfo['filename']; $res['name'] = $pathinfo['filename'];
return $res; return $res;
@ -798,6 +802,8 @@ trait Files
$pathinfo = pathinfo($messageMedia['file_name']); $pathinfo = pathinfo($messageMedia['file_name']);
if (isset($pathinfo['extension'])) { if (isset($pathinfo['extension'])) {
$res['ext'] = '.'.$pathinfo['extension']; $res['ext'] = '.'.$pathinfo['extension'];
} else {
$res['ext'] = '';
} }
$res['name'] = $pathinfo['filename']; $res['name'] = $pathinfo['filename'];
} }
@ -813,6 +819,8 @@ trait Files
$pathinfo = pathinfo($attribute['file_name']); $pathinfo = pathinfo($attribute['file_name']);
if (isset($pathinfo['extension'])) { if (isset($pathinfo['extension'])) {
$res['ext'] = '.'.$pathinfo['extension']; $res['ext'] = '.'.$pathinfo['extension'];
} else {
$res['ext'] = '';
} }
$res['name'] = $pathinfo['filename']; $res['name'] = $pathinfo['filename'];
break; break;