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 \Throwable|null $exception Exception to be thrown into the generator.
* @param mixed $value Value to be sent 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->exception = $exception;
$this->value = $value; $this->value = $value;
if (!$this->immediate) { if (!$this->immediate) {

View File

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

View File

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

View File

@ -119,7 +119,10 @@ class SeqLoop extends ResumableSignalLoop
yield from $this->save($update); 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->API->logger->logger('Was fed updates of type '.$updates['_'].'...', \danog\MadelineProto\Logger::VERBOSE);
$this->incomingUpdates[] = $updates; $this->incomingUpdates[] = $updates;
@ -128,7 +131,10 @@ class SeqLoop extends ResumableSignalLoop
{ {
$this->pendingWakeups += (yield from $this->feeder->feed($updates['updates'])); $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; $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; $this->toPts = $toPts;
} }

View File

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

View File

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

View File

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

View File

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