diff options
author | Joas Schilling <coding@schilljs.com> | 2020-10-13 13:50:45 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-10-13 13:50:45 +0300 |
commit | dddb7ef31d903e2023bb7872fc98b058262b59f5 (patch) | |
tree | cad2d982231ea0aa90ac3082e4e016e6e14b61c1 /lib | |
parent | 8b782d44d0faea082b21725bb9770ef7501812df (diff) |
Start fixing some psalm issues
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Migration/Version7000Date20190724121137.php | 4 | ||||
-rw-r--r-- | lib/Room.php | 12 | ||||
-rw-r--r-- | lib/Service/HostedSignalingServerService.php | 6 |
3 files changed, 13 insertions, 9 deletions
diff --git a/lib/Migration/Version7000Date20190724121137.php b/lib/Migration/Version7000Date20190724121137.php index f0dde5173..441d50773 100644 --- a/lib/Migration/Version7000Date20190724121137.php +++ b/lib/Migration/Version7000Date20190724121137.php @@ -44,7 +44,7 @@ class Version7000Date20190724121137 extends SimpleMigrationStep { * @param array $options * @since 13.0.0 */ - public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options) { + public function preSchemaChange(IOutput $output, \Closure $schemaClosure, array $options): void { $query = $this->connection->getQueryBuilder(); $query->select('p.user_id', 'p.room_id') ->selectAlias($query->createFunction('MAX(' . $query->getColumnName('c.id') . ')'), 'last_mention_message') @@ -81,7 +81,7 @@ class Version7000Date20190724121137 extends SimpleMigrationStep { * @throws SchemaException * @since 13.0.0 */ - public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options) { + public function changeSchema(IOutput $output, \Closure $schemaClosure, array $options): ?ISchemaWrapper { /** @var ISchemaWrapper $schema */ $schema = $schemaClosure(); diff --git a/lib/Room.php b/lib/Room.php index 1f827bf69..09d52f69b 100644 --- a/lib/Room.php +++ b/lib/Room.php @@ -152,7 +152,7 @@ class Room { /** @var string */ protected $currentUser; - /** @var Participant */ + /** @var Participant|null */ protected $participant; public function __construct(Manager $manager, @@ -1058,9 +1058,13 @@ class Room { ))); } - $query->setMaxResults($limit) - ->setFirstResult($offset) - ->orderBy('user_id', 'ASC'); + if ($limit !== null) { + $query->setMaxResults($limit); + } + if ($offset !== null) { + $query->setFirstResult($offset); + } + $query->orderBy('user_id', 'ASC'); $result = $query->execute(); $participants = []; diff --git a/lib/Service/HostedSignalingServerService.php b/lib/Service/HostedSignalingServerService.php index a279ed40a..4be96ae40 100644 --- a/lib/Service/HostedSignalingServerService.php +++ b/lib/Service/HostedSignalingServerService.php @@ -26,7 +26,6 @@ declare(strict_types=1); namespace OCA\Talk\Service; use GuzzleHttp\Exception\ClientException; -use OC\Security\SecureRandom; use OCA\Talk\DataObjects\AccountId; use OCA\Talk\DataObjects\RegisterAccountData; use OCA\Talk\Exceptions\HostedSignalingServerAPIException; @@ -35,6 +34,7 @@ use OCP\AppFramework\Http; use OCP\Http\Client\IClientService; use OCP\IConfig; use OCP\IL10N; +use OCP\Security\ISecureRandom; use Psr\Log\LoggerInterface; class HostedSignalingServerService { @@ -49,14 +49,14 @@ class HostedSignalingServerService { private $logger; /** @var IL10N */ private $l10n; - /** @var SecureRandom */ + /** @var ISecureRandom */ private $secureRandom; public function __construct(IConfig $config, IClientService $clientService, LoggerInterface $logger, IL10N $l10n, - SecureRandom $secureRandom) { + ISecureRandom $secureRandom) { $this->config = $config; $this->clientService = $clientService; $this->logger = $logger; |