Psalm fixes

This commit is contained in:
Daniil Gentili 2020-10-18 15:04:43 +02:00
parent bda520122d
commit bbc25e9aec
Signed by: danog
GPG Key ID: 8C1BE3B34B230CA7
10 changed files with 20 additions and 13 deletions

View File

@ -100,7 +100,7 @@ final class Coroutine implements Promise, \ArrayAccess, JsonSerializable
* @param \Throwable|null $exception Exception to be thrown into the generator.
* @param mixed $value Value to be sent into the generator.
*/
$this->onResolve = function ($exception, $value) {
$this->onResolve = function ($exception, $value): void {
$this->exception = $exception;
$this->value = $value;
if (!$this->immediate) {

View File

@ -24,6 +24,7 @@ abstract class DbPropertiesFactory
* @param string $table
* @param self::TYPE_*|array $propertyType
* @param $value
* @param DriverArray|null $value
*
* @return Promise<DbType>
*

View File

@ -126,7 +126,7 @@ class FeedLoop extends ResumableSignalLoop
continue;
}
if (isset($update['pts'], $update['pts_count'])) {
$logger = function ($msg) use ($update) {
$logger = function ($msg) use ($update): void {
$pts_count = $update['pts_count'];
$mid = isset($update['message']['id']) ? $update['message']['id'] : '-';
$mypts = $this->state->pts();

View File

@ -119,7 +119,10 @@ class SeqLoop extends ResumableSignalLoop
yield from $this->save($update);
}
}
public function feed($updates): void
/**
* @param (array|mixed)[] $updates
*/
public function feed(array $updates): void
{
$this->API->logger->logger('Was fed updates of type '.$updates['_'].'...', \danog\MadelineProto\Logger::VERBOSE);
$this->incomingUpdates[] = $updates;
@ -128,7 +131,10 @@ class SeqLoop extends ResumableSignalLoop
{
$this->pendingWakeups += (yield from $this->feeder->feed($updates['updates']));
}
public function addPendingWakeups($wakeups): void
/**
* @param true[] $wakeups
*/
public function addPendingWakeups(array $wakeups): void
{
$this->pendingWakeups += $wakeups;
}

View File

@ -216,7 +216,7 @@ class UpdateLoop extends ResumableSignalLoop
}
}
}
public function setLimit($toPts): void
public function setLimit(int $toPts): void
{
$this->toPts = $toPts;
}

View File

@ -543,7 +543,7 @@ trait AuthKeyHandler
$this->pending_auth = true;
continue;
}
$dcs[$id] = function () use ($id, $socket) {
$dcs[$id] = function () use ($id, $socket): \Generator {
return $this->initAuthorizationSocket($id, $socket);
};
}

View File

@ -121,7 +121,7 @@ trait Files
throw new Exception('Invalid callable provided');
}
if ($cb === null) {
$cb = function ($percent) {
$cb = function ($percent): void {
$this->logger->logger('Upload status: '.$percent.'%', \danog\MadelineProto\Logger::NOTICE);
};
}
@ -155,7 +155,7 @@ trait Files
$promises = [];
$speed = 0;
$time = 0;
$cb = function () use ($cb, $part_total_num, &$speed, &$time) {
$cb = function () use ($cb, $part_total_num, &$speed, &$time): void {
static $cur = 0;
$cur++;
Tools::callFork($cb($cur * 100 / $part_total_num, $speed, $time));
@ -845,7 +845,7 @@ trait Files
throw new Exception('Wrong callable provided');
}
if ($cb === null) {
$cb = function ($percent) {
$cb = function ($percent): void {
$this->logger->logger('Download status: '.$percent.'%', \danog\MadelineProto\Logger::NOTICE);
};
}
@ -898,7 +898,7 @@ trait Files
$time = 0;
$speed = 0;
$origCb = $cb;
$cb = static function () use ($cb, $count, &$time, &$speed) {
$cb = static function () use ($cb, $count, &$time, &$speed): void {
static $cur = 0;
$cur++;
Tools::callFork($cb($cur * 100 / $count, $time, $speed));

View File

@ -1089,7 +1089,7 @@ trait PeerHandler
{
return $this->channelParticipants[$this->participantsKey($channel['channel_id'], $filter, $q, $offset, $limit)];
}
private function storeParticipantsCache($gres, $channel, $filter, $q, $offset, $limit)
private function storeParticipantsCache($gres, $channel, $filter, $q, $offset, $limit): void
{
unset($gres['users']);
$ids = [];

View File

@ -119,7 +119,7 @@ class MyTelegramOrgWrapper
{
$this->logger = $logger;
}
public function getLogger()
public function getLogger(): Logger
{
return $this->logger;
}

View File

@ -64,7 +64,7 @@ abstract class Tools extends StrTools
*/
public static function convertJsonTL(array $input): array
{
$cb = static function (&$val) use (&$cb) {
$cb = static function (&$val) use (&$cb): void {
if (isset($val['@type'])) {
$val['_'] = $val['@type'];
} elseif (\is_array($val)) {