diff options
author | Joas Schilling <213943+nickvergessen@users.noreply.github.com> | 2021-12-07 13:12:32 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-12-07 13:12:32 +0300 |
commit | 3635f89b21a6af0eb376efb44de7dfa993671188 (patch) | |
tree | 5365b523f90728dcc89df7d8d6c9ca8c24f4606f /lib | |
parent | a60ff07c63a5f62968361b4fbbda1915fad84cbe (diff) | |
parent | d4f6ff8123e0eea1dc6c01f45538890dd672c812 (diff) |
Merge pull request #6664 from nextcloud/feature/reduce-psalm-info
Reduce psalm info
Diffstat (limited to 'lib')
-rw-r--r-- | lib/BackgroundJob/RetryJob.php | 2 | ||||
-rw-r--r-- | lib/Chat/AutoComplete/Sorter.php | 4 | ||||
-rw-r--r-- | lib/Chat/Command/Executor.php | 5 | ||||
-rw-r--r-- | lib/Chat/Parser/UserMention.php | 2 | ||||
-rw-r--r-- | lib/Config.php | 2 | ||||
-rw-r--r-- | lib/Events/GetTurnServersEvent.php | 2 | ||||
-rw-r--r-- | lib/Federation/CloudFederationProviderTalk.php | 12 | ||||
-rw-r--r-- | lib/Migration/Version2001Date20170707115443.php | 4 | ||||
-rw-r--r-- | lib/Model/SessionMapper.php | 4 | ||||
-rw-r--r-- | lib/Settings/Admin/AdminSettings.php | 2 |
10 files changed, 23 insertions, 16 deletions
diff --git a/lib/BackgroundJob/RetryJob.php b/lib/BackgroundJob/RetryJob.php index f5b1fc417..3fd346177 100644 --- a/lib/BackgroundJob/RetryJob.php +++ b/lib/BackgroundJob/RetryJob.php @@ -64,7 +64,7 @@ class RetryJob extends Job { * @param IJobList $jobList * @param ILogger|null $logger */ - public function execute(IJobList $jobList, ?ILogger $logger = null) { + public function execute(IJobList $jobList, ?ILogger $logger = null): void { if (((int)$this->argument['try']) > $this->maxTry) { $jobList->remove($this, $this->argument); return; diff --git a/lib/Chat/AutoComplete/Sorter.php b/lib/Chat/AutoComplete/Sorter.php index e7cb173df..cf2e485b2 100644 --- a/lib/Chat/AutoComplete/Sorter.php +++ b/lib/Chat/AutoComplete/Sorter.php @@ -63,13 +63,13 @@ class Sorter implements ISorter { $context['itemId'], 'comment', $type, - array_map(function ($suggestion) { + array_map(function (array $suggestion) { return $suggestion['value']['shareWith']; }, $byType)); $search = $context['search']; - usort($byType, function ($a, $b) use ($lastComments, $search) { + usort($byType, function (array $a, array $b) use ($lastComments, $search) { if ($search) { // If the user searched for "Dani" we make sure "Daniel" comes before "Madani" if (stripos($a['label'], $search) === 0) { diff --git a/lib/Chat/Command/Executor.php b/lib/Chat/Command/Executor.php index 0862936c4..121f53fe2 100644 --- a/lib/Chat/Command/Executor.php +++ b/lib/Chat/Command/Executor.php @@ -140,8 +140,9 @@ class Executor { } $response = trim($response); - if (strpos($response, "\n")) { - $tempHelp = substr($response, 0, strpos($response, "\n")); + $newLinePosition = strpos($response, "\n"); + if ($newLinePosition !== false) { + $tempHelp = substr($response, 0, $newLinePosition); if ($tempHelp === 'Description:') { $hasHelpSection = strpos($response, "\nHelp:\n"); if ($hasHelpSection !== false) { diff --git a/lib/Chat/Parser/UserMention.php b/lib/Chat/Parser/UserMention.php index 743fb2caa..a3a3679c9 100644 --- a/lib/Chat/Parser/UserMention.php +++ b/lib/Chat/Parser/UserMention.php @@ -86,7 +86,7 @@ class UserMention { $mentions = $comment->getMentions(); // TODO This can be removed once getMentions() returns sorted results (Nextcloud 21+) - usort($mentions, static function ($m1, $m2) { + usort($mentions, static function (array $m1, array $m2) { return mb_strlen($m2['id']) <=> mb_strlen($m1['id']); }); diff --git a/lib/Config.php b/lib/Config.php index b841b39b8..b80ec70e6 100644 --- a/lib/Config.php +++ b/lib/Config.php @@ -231,7 +231,7 @@ class Config { * * @return array */ - public function getTurnServers($withEvent = true): array { + public function getTurnServers(bool $withEvent = true): array { $config = $this->config->getAppValue('spreed', 'turn_servers'); $servers = json_decode($config, true); diff --git a/lib/Events/GetTurnServersEvent.php b/lib/Events/GetTurnServersEvent.php index b3611abe2..788b6abe1 100644 --- a/lib/Events/GetTurnServersEvent.php +++ b/lib/Events/GetTurnServersEvent.php @@ -39,7 +39,7 @@ class GetTurnServersEvent extends Event { return $this->servers; } - public function setServers(array $servers) { + public function setServers(array $servers): void { $this->servers = $servers; } } diff --git a/lib/Federation/CloudFederationProviderTalk.php b/lib/Federation/CloudFederationProviderTalk.php index daf85efad..a2fa48b62 100644 --- a/lib/Federation/CloudFederationProviderTalk.php +++ b/lib/Federation/CloudFederationProviderTalk.php @@ -28,6 +28,7 @@ namespace OCA\Talk\Federation; use Exception; use OCA\FederatedFileSharing\AddressHandler; use OCA\Talk\AppInfo\Application; +use OCA\Talk\Config; use OCA\Talk\Manager; use OCA\Talk\Model\Attendee; use OCA\Talk\Model\AttendeeMapper; @@ -60,6 +61,9 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { /** @var FederationManager */ private $federationManager; + /** @var Config */ + private $config; + /** @var INotificationManager */ private $notificationManager; @@ -79,6 +83,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { IUserManager $userManager, AddressHandler $addressHandler, FederationManager $federationManager, + Config $config, INotificationManager $notificationManager, IURLGenerator $urlGenerator, ParticipantService $participantService, @@ -88,6 +93,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { $this->userManager = $userManager; $this->addressHandler = $addressHandler; $this->federationManager = $federationManager; + $this->config = $config; $this->notificationManager = $notificationManager; $this->urlGenerator = $urlGenerator; $this->participantService = $participantService; @@ -108,7 +114,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { * @throws DBException */ public function shareReceived(ICloudFederationShare $share): string { - if (!$this->federationManager->isEnabled()) { + if (!$this->config->isFederationEnabled()) { throw new ProviderCouldNotAddShareException('Server does not support talk federation', '', Http::STATUS_SERVICE_UNAVAILABLE); } if (!in_array($share->getShareType(), $this->getSupportedShareTypes(), true)) { @@ -232,7 +238,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { * @throws ShareNotFound */ private function getAttendeeAndValidate(int $id, string $sharedSecret): Attendee { - if (!$this->federationManager->isEnabled()) { + if (!$this->config->isFederationEnabled()) { throw new ActionNotSupportedException('Server does not support Talk federation'); } @@ -275,7 +281,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { return $attendee; } - private function notifyAboutNewShare(IUser $shareWith, string $shareId, string $sharedByFederatedId, string $sharedByName, string $roomName, string $roomToken, string $serverUrl) { + private function notifyAboutNewShare(IUser $shareWith, string $shareId, string $sharedByFederatedId, string $sharedByName, string $roomName, string $roomToken, string $serverUrl): void { $notification = $this->notificationManager->createNotification(); $notification->setApp(Application::APP_ID) ->setUser($shareWith->getUID()) diff --git a/lib/Migration/Version2001Date20170707115443.php b/lib/Migration/Version2001Date20170707115443.php index e80c78276..5c9f44b1d 100644 --- a/lib/Migration/Version2001Date20170707115443.php +++ b/lib/Migration/Version2001Date20170707115443.php @@ -136,7 +136,7 @@ class Version2001Date20170707115443 extends SimpleMigrationStep { ->where($update->expr()->in('roomId', $update->createNamedParameter($one2oneRooms, IQueryBuilder::PARAM_INT_ARRAY))); } - return (int) $update->executeStatement(); + return $update->executeStatement(); } /** @@ -160,6 +160,6 @@ class Version2001Date20170707115443 extends SimpleMigrationStep { $update->andWhere($update->expr()->notIn('roomId', $update->createNamedParameter($one2oneRooms, IQueryBuilder::PARAM_INT_ARRAY))); } - return (int) $update->executeStatement(); + return $update->executeStatement(); } } diff --git a/lib/Model/SessionMapper.php b/lib/Model/SessionMapper.php index ddc5460d2..1b747eace 100644 --- a/lib/Model/SessionMapper.php +++ b/lib/Model/SessionMapper.php @@ -75,7 +75,7 @@ class SessionMapper extends QBMapper { $delete->delete($this->getTableName()) ->where($delete->expr()->eq('attendee_id', $delete->createNamedParameter($attendeeId, IQueryBuilder::PARAM_INT))); - return (int) $delete->executeStatement(); + return $delete->executeStatement(); } /** @@ -87,7 +87,7 @@ class SessionMapper extends QBMapper { $delete->delete($this->getTableName()) ->where($delete->expr()->in('id', $delete->createNamedParameter($ids, IQueryBuilder::PARAM_INT_ARRAY))); - return (int) $delete->executeStatement(); + return $delete->executeStatement(); } public function createSessionFromRow(array $row): Session { diff --git a/lib/Settings/Admin/AdminSettings.php b/lib/Settings/Admin/AdminSettings.php index a4c5cc447..01a6efb5f 100644 --- a/lib/Settings/Admin/AdminSettings.php +++ b/lib/Settings/Admin/AdminSettings.php @@ -469,7 +469,7 @@ class AdminSettings implements ISettings { } $languages['commonLanguages'] = array_values($languages['commonLanguages']); // TODO maybe filter out languages with an _ - usort($countries, function ($a, $b) { + usort($countries, function (array $a, array $b) { return strcmp($a['name'], $b['name']); }); $this->initialState->provideInitialState('hosted_signaling_server_language_data', [ |