From 3c37444aab66f70b78505c473ed12dec3a6bbaf8 Mon Sep 17 00:00:00 2001 From: Christoph Wurst Date: Mon, 28 Dec 2020 14:18:27 +0100 Subject: [PATCH] fixup! Bump vimeo/psalm from 4.2.1 to 4.3.0 Signed-off-by: Christoph Wurst --- .../lib/Controller/UserStoragesController.php | 2 +- .../lib/Controller/CheckSetupController.php | 4 +- composer.lock | 16 ++-- .../Version13000Date20170718121200.php | 2 +- core/ajax/update.php | 63 +++++++------ lib/composer/composer/installed.json | 6 +- .../App/AppStore/Bundles/EducationBundle.php | 2 +- .../App/AppStore/Bundles/GroupwareBundle.php | 2 +- .../AppStore/Bundles/SocialSharingBundle.php | 2 +- lib/private/App/DependencyAnalyzer.php | 18 ++-- .../Collaboration/Collaborators/Search.php | 2 +- .../ExpressionBuilder/ExpressionBuilder.php | 2 +- .../PgSqlExpressionBuilder.php | 4 +- .../Files/Storage/Wrapper/Encoding.php | 2 +- lib/private/L10N/Factory.php | 6 +- lib/private/Notification/Notification.php | 2 +- lib/private/OCS/Result.php | 4 +- lib/private/Preview/TXT.php | 2 +- lib/private/Route/Router.php | 2 +- lib/private/Security/Normalizer/IpAddress.php | 4 +- lib/private/Template/JSConfigHelper.php | 90 +++++++++---------- lib/private/User/User.php | 32 ++++--- lib/public/AppFramework/Db/QBMapper.php | 2 - 23 files changed, 140 insertions(+), 131 deletions(-) diff --git a/apps/files_external/lib/Controller/UserStoragesController.php b/apps/files_external/lib/Controller/UserStoragesController.php index c297d3db38e38..c1b4db38133e6 100644 --- a/apps/files_external/lib/Controller/UserStoragesController.php +++ b/apps/files_external/lib/Controller/UserStoragesController.php @@ -199,7 +199,7 @@ public function update( } catch (NotFoundException $e) { return new DataResponse( [ - 'message' => (string)$this->l10n->t('Storage with ID "%d" not found', [$id]) + 'message' => $this->l10n->t('Storage with ID "%d" not found', [$id]) ], Http::STATUS_NOT_FOUND ); diff --git a/apps/settings/lib/Controller/CheckSetupController.php b/apps/settings/lib/Controller/CheckSetupController.php index 7c72f7b3b4583..50f290d617315 100644 --- a/apps/settings/lib/Controller/CheckSetupController.php +++ b/apps/settings/lib/Controller/CheckSetupController.php @@ -237,9 +237,9 @@ private function isUsedTlsLibOutdated() { return ''; } - $features = (string)$this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); + $features = $this->l10n->t('installing and updating apps via the app store or Federated Cloud Sharing'); if (!$this->config->getSystemValue('appstoreenabled', true)) { - $features = (string)$this->l10n->t('Federated Cloud Sharing'); + $features = $this->l10n->t('Federated Cloud Sharing'); } // Check if at least OpenSSL after 1.01d or 1.0.2b diff --git a/composer.lock b/composer.lock index bac374207ec71..ea2467c4aab53 100644 --- a/composer.lock +++ b/composer.lock @@ -2766,16 +2766,16 @@ }, { "name": "vimeo/psalm", - "version": "4.3.0", + "version": "4.3.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "6f916553a8de3c5c2483162b6cc01b21b24e4d1d" + "reference": "2feba22a005a18bf31d4c7b9bdb9252c73897476" }, "dist": { "type": "zip", - "url": "https://github.com/gitapi/repos/vimeo/psalm/zipball/6f916553a8de3c5c2483162b6cc01b21b24e4d1d", - "reference": "6f916553a8de3c5c2483162b6cc01b21b24e4d1d", + "url": "https://github.com/gitapi/repos/vimeo/psalm/zipball/2feba22a005a18bf31d4c7b9bdb9252c73897476", + "reference": "2feba22a005a18bf31d4c7b9bdb9252c73897476", "shasum": "" }, "require": { @@ -2863,7 +2863,11 @@ "inspection", "php" ], - "time": "2020-12-02T22:13:45+00:00" + "support": { + "issues": "https://github.com/vimeo/psalm/issues", + "source": "https://github.com/vimeo/psalm/tree/4.3.1" + }, + "time": "2020-12-03T16:44:10+00:00" }, { "name": "webmozart/assert", @@ -2974,5 +2978,5 @@ "ext-xmlreader": "*" }, "platform-dev": [], - "plugin-api-version": "1.1.0" + "plugin-api-version": "2.0.0" } diff --git a/core/Migrations/Version13000Date20170718121200.php b/core/Migrations/Version13000Date20170718121200.php index 41492905a04b2..f85b379f89ed1 100644 --- a/core/Migrations/Version13000Date20170718121200.php +++ b/core/Migrations/Version13000Date20170718121200.php @@ -1031,7 +1031,7 @@ public function postSchemaChange(IOutput $output, \Closure $schemaClosure, array $insert->setParameter('propertypath', (string) $row['propertypath']) ->setParameter('propertyname', (string) $row['propertyname']) ->setParameter('propertyvalue', (string) $row['propertyvalue']) - ->setParameter('userid', (string) ($match[2] ?? '')); + ->setParameter('userid', ($match[2] ?? '')); $insert->execute(); } } diff --git a/core/ajax/update.php b/core/ajax/update.php index 137df3097a11f..09931ec91e2c1 100644 --- a/core/ajax/update.php +++ b/core/ajax/update.php @@ -47,7 +47,7 @@ // need to send an initial message to force-init the event source, // which will then trigger its own CSRF check and produces its own CSRF error // message -$eventSource->send('success', (string)$l->t('Preparing update')); +$eventSource->send('success', $l->t('Preparing update')); class FeedBackHandler { /** @var integer */ @@ -83,23 +83,23 @@ public function handleRepairFeedback($event) { if (empty($desc)) { $desc = $this->currentStep; } - $this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc])); + $this->eventSource->send('success', $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $desc])); break; case '\OC\Repair::finishProgress': $this->progressStateMax = $this->progressStateStep; - $this->eventSource->send('success', (string)$this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep])); + $this->eventSource->send('success', $this->l10n->t('[%d / %d]: %s', [$this->progressStateStep, $this->progressStateMax, $this->currentStep])); break; case '\OC\Repair::step': - $this->eventSource->send('success', (string)$this->l10n->t('Repair step:') . ' ' . $event->getArgument(0)); + $this->eventSource->send('success', $this->l10n->t('Repair step:') . ' ' . $event->getArgument(0)); break; case '\OC\Repair::info': - $this->eventSource->send('success', (string)$this->l10n->t('Repair info:') . ' ' . $event->getArgument(0)); + $this->eventSource->send('success', $this->l10n->t('Repair info:') . ' ' . $event->getArgument(0)); break; case '\OC\Repair::warning': - $this->eventSource->send('notice', (string)$this->l10n->t('Repair warning:') . ' ' . $event->getArgument(0)); + $this->eventSource->send('notice', $this->l10n->t('Repair warning:') . ' ' . $event->getArgument(0)); break; case '\OC\Repair::error': - $this->eventSource->send('notice', (string)$this->l10n->t('Repair error:') . ' ' . $event->getArgument(0)); + $this->eventSource->send('notice', $this->l10n->t('Repair error:') . ' ' . $event->getArgument(0)); break; } } @@ -108,7 +108,7 @@ public function handleRepairFeedback($event) { if (\OCP\Util::needUpgrade()) { $config = \OC::$server->getSystemConfig(); if ($config->getValue('upgrade.disable-web', false)) { - $eventSource->send('failure', (string)$l->t('Please use the command line updater because automatic updating is disabled in the config.php.')); + $eventSource->send('failure', $l->t('Please use the command line updater because automatic updating is disabled in the config.php.')); $eventSource->close(); exit(); } @@ -130,12 +130,12 @@ public function handleRepairFeedback($event) { $dispatcher = \OC::$server->getEventDispatcher(); $dispatcher->addListener('\OC\DB\Migrator::executeSql', function ($event) use ($eventSource, $l) { if ($event instanceof GenericEvent) { - $eventSource->send('success', (string)$l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()])); + $eventSource->send('success', $l->t('[%d / %d]: %s', [$event[0], $event[1], $event->getSubject()])); } }); $dispatcher->addListener('\OC\DB\Migrator::checkTable', function ($event) use ($eventSource, $l) { if ($event instanceof GenericEvent) { - $eventSource->send('success', (string)$l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()])); + $eventSource->send('success', $l->t('[%d / %d]: Checking table %s', [$event[0], $event[1], $event->getSubject()])); } }); $feedBack = new FeedBackHandler($eventSource, $l); @@ -148,46 +148,46 @@ public function handleRepairFeedback($event) { $dispatcher->addListener('\OC\Repair::error', [$feedBack, 'handleRepairFeedback']); $updater->listen('\OC\Updater', 'maintenanceEnabled', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Turned on maintenance mode')); + $eventSource->send('success', $l->t('Turned on maintenance mode')); }); $updater->listen('\OC\Updater', 'maintenanceDisabled', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Turned off maintenance mode')); + $eventSource->send('success', $l->t('Turned off maintenance mode')); }); $updater->listen('\OC\Updater', 'maintenanceActive', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Maintenance mode is kept active')); + $eventSource->send('success', $l->t('Maintenance mode is kept active')); }); $updater->listen('\OC\Updater', 'dbUpgradeBefore', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Updating database schema')); + $eventSource->send('success', $l->t('Updating database schema')); }); $updater->listen('\OC\Updater', 'dbUpgrade', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Updated database')); + $eventSource->send('success', $l->t('Updated database')); }); $updater->listen('\OC\Updater', 'dbSimulateUpgradeBefore', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)')); + $eventSource->send('success', $l->t('Checking whether the database schema can be updated (this can take a long time depending on the database size)')); }); $updater->listen('\OC\Updater', 'dbSimulateUpgrade', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Checked database schema update')); + $eventSource->send('success', $l->t('Checked database schema update')); }); $updater->listen('\OC\Updater', 'appUpgradeCheckBefore', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Checking updates of apps')); + $eventSource->send('success', $l->t('Checking updates of apps')); }); $updater->listen('\OC\Updater', 'checkAppStoreAppBefore', function ($app) use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Checking for update of app "%s" in appstore', [$app])); + $eventSource->send('success', $l->t('Checking for update of app "%s" in appstore', [$app])); }); $updater->listen('\OC\Updater', 'upgradeAppStoreApp', function ($app) use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Update app "%s" from appstore', [$app])); + $eventSource->send('success', $l->t('Update app "%s" from appstore', [$app])); }); $updater->listen('\OC\Updater', 'checkAppStoreApp', function ($app) use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Checked for update of app "%s" in appstore', [$app])); + $eventSource->send('success', $l->t('Checked for update of app "%s" in appstore', [$app])); }); $updater->listen('\OC\Updater', 'appSimulateUpdate', function ($app) use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app])); + $eventSource->send('success', $l->t('Checking whether the database schema for %s can be updated (this can take a long time depending on the database size)', [$app])); }); $updater->listen('\OC\Updater', 'appUpgradeCheck', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Checked database schema update for apps')); + $eventSource->send('success', $l->t('Checked database schema update for apps')); }); $updater->listen('\OC\Updater', 'appUpgrade', function ($app, $version) use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Updated "%1$s" to %2$s', [$app, $version])); + $eventSource->send('success', $l->t('Updated "%1$s" to %2$s', [$app, $version])); }); $updater->listen('\OC\Updater', 'incompatibleAppDisabled', function ($app) use (&$incompatibleApps) { $incompatibleApps[] = $app; @@ -198,16 +198,16 @@ public function handleRepairFeedback($event) { $config->setSystemValue('maintenance', false); }); $updater->listen('\OC\Updater', 'setDebugLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Set log level to debug')); + $eventSource->send('success', $l->t('Set log level to debug')); }); $updater->listen('\OC\Updater', 'resetLogLevel', function ($logLevel, $logLevelName) use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Reset log level')); + $eventSource->send('success', $l->t('Reset log level')); }); $updater->listen('\OC\Updater', 'startCheckCodeIntegrity', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Starting code integrity check')); + $eventSource->send('success', $l->t('Starting code integrity check')); }); $updater->listen('\OC\Updater', 'finishedCheckCodeIntegrity', function () use ($eventSource, $l) { - $eventSource->send('success', (string)$l->t('Finished code integrity check')); + $eventSource->send('success', $l->t('Finished code integrity check')); }); try { @@ -224,15 +224,14 @@ public function handleRepairFeedback($event) { $disabledApps = []; foreach ($incompatibleApps as $app) { - $disabledApps[$app] = (string) $l->t('%s (incompatible)', [$app]); + $disabledApps[$app] = $l->t('%s (incompatible)', [$app]); } if (!empty($disabledApps)) { - $eventSource->send('notice', - (string)$l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)])); + $eventSource->send('notice', $l->t('The following apps have been disabled: %s', [implode(', ', $disabledApps)])); } } else { - $eventSource->send('notice', (string)$l->t('Already up to date')); + $eventSource->send('notice', $l->t('Already up to date')); } $eventSource->send('done', ''); diff --git a/lib/composer/composer/installed.json b/lib/composer/composer/installed.json index fe51488c7066f..f20a6c47c6d4f 100644 --- a/lib/composer/composer/installed.json +++ b/lib/composer/composer/installed.json @@ -1 +1,5 @@ -[] +{ + "packages": [], + "dev": false, + "dev-package-names": [] +} diff --git a/lib/private/App/AppStore/Bundles/EducationBundle.php b/lib/private/App/AppStore/Bundles/EducationBundle.php index 05d6fbbd9d76a..f59e8a115e2f5 100644 --- a/lib/private/App/AppStore/Bundles/EducationBundle.php +++ b/lib/private/App/AppStore/Bundles/EducationBundle.php @@ -29,7 +29,7 @@ class EducationBundle extends Bundle { * {@inheritDoc} */ public function getName() { - return (string)$this->l10n->t('Education Edition'); + return $this->l10n->t('Education Edition'); } /** diff --git a/lib/private/App/AppStore/Bundles/GroupwareBundle.php b/lib/private/App/AppStore/Bundles/GroupwareBundle.php index 49ae1068b1012..604ed44aa08d8 100644 --- a/lib/private/App/AppStore/Bundles/GroupwareBundle.php +++ b/lib/private/App/AppStore/Bundles/GroupwareBundle.php @@ -30,7 +30,7 @@ class GroupwareBundle extends Bundle { * {@inheritDoc} */ public function getName() { - return (string)$this->l10n->t('Groupware bundle'); + return $this->l10n->t('Groupware bundle'); } /** diff --git a/lib/private/App/AppStore/Bundles/SocialSharingBundle.php b/lib/private/App/AppStore/Bundles/SocialSharingBundle.php index 8ce4d1080ffe1..cd063f6fa882e 100644 --- a/lib/private/App/AppStore/Bundles/SocialSharingBundle.php +++ b/lib/private/App/AppStore/Bundles/SocialSharingBundle.php @@ -29,7 +29,7 @@ class SocialSharingBundle extends Bundle { * {@inheritDoc} */ public function getName() { - return (string)$this->l10n->t('Social sharing bundle'); + return $this->l10n->t('Social sharing bundle'); } /** diff --git a/lib/private/App/DependencyAnalyzer.php b/lib/private/App/DependencyAnalyzer.php index eb114adbb48aa..8476f9bc14556 100644 --- a/lib/private/App/DependencyAnalyzer.php +++ b/lib/private/App/DependencyAnalyzer.php @@ -158,19 +158,19 @@ private function analyzePhpVersion(array $dependencies) { if (isset($dependencies['php']['@attributes']['min-version'])) { $minVersion = $dependencies['php']['@attributes']['min-version']; if ($this->compareSmaller($this->platform->getPhpVersion(), $minVersion)) { - $missing[] = (string)$this->l->t('PHP %s or higher is required.', [$minVersion]); + $missing[] = $this->l->t('PHP %s or higher is required.', [$minVersion]); } } if (isset($dependencies['php']['@attributes']['max-version'])) { $maxVersion = $dependencies['php']['@attributes']['max-version']; if ($this->compareBigger($this->platform->getPhpVersion(), $maxVersion)) { - $missing[] = (string)$this->l->t('PHP with a version lower than %s is required.', [$maxVersion]); + $missing[] = $this->l->t('PHP with a version lower than %s is required.', [$maxVersion]); } } if (isset($dependencies['php']['@attributes']['min-int-size'])) { $intSize = $dependencies['php']['@attributes']['min-int-size']; if ($intSize > $this->platform->getIntSize() * 8) { - $missing[] = (string)$this->l->t('%sbit or higher PHP required.', [$intSize]); + $missing[] = $this->l->t('%sbit or higher PHP required.', [$intSize]); } } return $missing; @@ -194,7 +194,7 @@ private function analyzeArchitecture(array $dependencies) { }, $supportedArchitectures); $currentArchitecture = $this->platform->getArchitecture(); if (!in_array($currentArchitecture, $supportedArchitectures, true)) { - $missing[] = (string)$this->l->t('The following architectures are supported: %s', [implode(', ', $supportedArchitectures)]); + $missing[] = $this->l->t('The following architectures are supported: %s', [implode(', ', $supportedArchitectures)]); } return $missing; } @@ -221,7 +221,7 @@ private function analyzeDatabases(array $dependencies) { }, $supportedDatabases); $currentDatabase = $this->platform->getDatabase(); if (!in_array($currentDatabase, $supportedDatabases)) { - $missing[] = (string)$this->l->t('The following databases are supported: %s', [implode(', ', $supportedDatabases)]); + $missing[] = $this->l->t('The following databases are supported: %s', [implode(', ', $supportedDatabases)]); } return $missing; } @@ -250,7 +250,7 @@ private function analyzeCommands(array $dependencies) { } $commandName = $this->getValue($command); if (!$this->platform->isCommandKnown($commandName)) { - $missing[] = (string)$this->l->t('The command line tool %s could not be found', [$commandName]); + $missing[] = $this->l->t('The command line tool %s could not be found', [$commandName]); } } return $missing; @@ -324,7 +324,7 @@ private function analyzeOS(array $dependencies) { } $currentOS = $this->platform->getOS(); if (!in_array($currentOS, $oss)) { - $missing[] = (string)$this->l->t('The following platforms are supported: %s', [implode(', ', $oss)]); + $missing[] = $this->l->t('The following platforms are supported: %s', [implode(', ', $oss)]); } return $missing; } @@ -350,12 +350,12 @@ private function analyzeOC(array $dependencies, array $appInfo, bool $ignoreMax) if (!is_null($minVersion)) { if ($this->compareSmaller($this->platform->getOcVersion(), $minVersion)) { - $missing[] = (string)$this->l->t('Server version %s or higher is required.', [$this->toVisibleVersion($minVersion)]); + $missing[] = $this->l->t('Server version %s or higher is required.', [$this->toVisibleVersion($minVersion)]); } } if (!$ignoreMax && !is_null($maxVersion)) { if ($this->compareBigger($this->platform->getOcVersion(), $maxVersion)) { - $missing[] = (string)$this->l->t('Server version %s or lower is required.', [$this->toVisibleVersion($maxVersion)]); + $missing[] = $this->l->t('Server version %s or lower is required.', [$this->toVisibleVersion($maxVersion)]); } } return $missing; diff --git a/lib/private/Collaboration/Collaborators/Search.php b/lib/private/Collaboration/Collaborators/Search.php index 7b5789640a090..79dfd5e1d8269 100644 --- a/lib/private/Collaboration/Collaborators/Search.php +++ b/lib/private/Collaboration/Collaborators/Search.php @@ -100,7 +100,7 @@ public function search($search, array $shareTypes, $lookup, $limit, $offset) { $searchResult->unsetResult($emailType); } - return [$searchResult->asArray(), (bool)$hasMoreResults]; + return [$searchResult->asArray(), $hasMoreResults]; } public function registerPlugin(array $pluginInfo) { diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php index 61eea80640e16..612f1c7a88d2d 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/ExpressionBuilder.php @@ -428,7 +428,7 @@ public function literal($input, $type = null) { * @return string */ public function castColumn($column, $type) { - return new QueryFunction( + return (string) new QueryFunction( $this->helper->quoteColumnName($column) ); } diff --git a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php index 141a93ff75aa8..3a9e2c4364b84 100644 --- a/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php +++ b/lib/private/DB/QueryBuilder/ExpressionBuilder/PgSqlExpressionBuilder.php @@ -39,9 +39,9 @@ class PgSqlExpressionBuilder extends ExpressionBuilder { public function castColumn($column, $type) { switch ($type) { case IQueryBuilder::PARAM_INT: - return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS INT)'); + return (string) new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS INT)'); case IQueryBuilder::PARAM_STR: - return new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS TEXT)'); + return (string) new QueryFunction('CAST(' . $this->helper->quoteColumnName($column) . ' AS TEXT)'); default: return parent::castColumn($column, $type); } diff --git a/lib/private/Files/Storage/Wrapper/Encoding.php b/lib/private/Files/Storage/Wrapper/Encoding.php index 02e82211dab4b..58dd81fce3519 100644 --- a/lib/private/Files/Storage/Wrapper/Encoding.php +++ b/lib/private/Files/Storage/Wrapper/Encoding.php @@ -58,7 +58,7 @@ public function __construct($parameters) { * @return bool true if the string is all ASCII, false otherwise */ private function isAscii($str) { - return (bool) !preg_match('/[\\x80-\\xff]+/', $str); + return !preg_match('/[\\x80-\\xff]+/', $str); } /** diff --git a/lib/private/L10N/Factory.php b/lib/private/L10N/Factory.php index 9c9a3cc951e22..471914755805e 100644 --- a/lib/private/L10N/Factory.php +++ b/lib/private/L10N/Factory.php @@ -123,7 +123,7 @@ public function get($app, $lang = null, $locale = null) { return new LazyL10N(function () use ($app, $lang, $locale) { $app = \OC_App::cleanAppId($app); if ($lang !== null) { - $lang = str_replace(['\0', '/', '\\', '..'], '', (string)$lang); + $lang = str_replace(['\0', '/', '\\', '..'], '', $lang); } $forceLang = $this->config->getSystemValue('force_language', false); @@ -617,7 +617,7 @@ public function getLanguages() { $forceLanguage = $this->config->getSystemValue('force_language', false); if ($forceLanguage !== false) { $l = $this->get('lib', $forceLanguage); - $potentialName = (string) $l->t('__language_name__'); + $potentialName = $l->t('__language_name__'); return [ 'commonlanguages' => [[ @@ -636,7 +636,7 @@ public function getLanguages() { foreach ($languageCodes as $lang) { $l = $this->get('lib', $lang); // TRANSLATORS this is the language name for the language switcher in the personal settings and should be the localized version - $potentialName = (string) $l->t('__language_name__'); + $potentialName = $l->t('__language_name__'); if ($l->getLanguageCode() === $lang && $potentialName[0] !== '_') {//first check if the language name is in the translation file $ln = [ 'code' => $lang, diff --git a/lib/private/Notification/Notification.php b/lib/private/Notification/Notification.php index 8ac4e19b7d1ad..c0848817361b4 100644 --- a/lib/private/Notification/Notification.php +++ b/lib/private/Notification/Notification.php @@ -206,7 +206,7 @@ public function setObject(string $type, string $id): INotification { if ($id === '' || isset($id[64])) { throw new \InvalidArgumentException('The given object id is invalid'); } - $this->objectId = (string) $id; + $this->objectId = $id; return $this; } diff --git a/lib/private/OCS/Result.php b/lib/private/OCS/Result.php index 0199783b47d2f..be2e6259309ec 100644 --- a/lib/private/OCS/Result.php +++ b/lib/private/OCS/Result.php @@ -104,10 +104,10 @@ public function getMeta() { $meta['status'] = $this->succeeded() ? 'ok' : 'failure'; $meta['statuscode'] = $this->statusCode; $meta['message'] = $this->message; - if (isset($this->items)) { + if ($this->items !== null) { $meta['totalitems'] = $this->items; } - if (isset($this->perPage)) { + if ($this->perPage !== null) { $meta['itemsperpage'] = $this->perPage; } return $meta; diff --git a/lib/private/Preview/TXT.php b/lib/private/Preview/TXT.php index 968a15a5683e4..9c5b7aa144033 100644 --- a/lib/private/Preview/TXT.php +++ b/lib/private/Preview/TXT.php @@ -85,7 +85,7 @@ public function getThumbnail(File $file, int $maxX, int $maxY): ?IImage { foreach ($lines as $index => $line) { $index = $index + 1; - $x = (int) 1; + $x = 1; $y = (int) ($index * $lineSize); if ($canUseTTF === true) { diff --git a/lib/private/Route/Router.php b/lib/private/Route/Router.php index 71bc4a6c4f7d8..3c897c5ce4957 100644 --- a/lib/private/Route/Router.php +++ b/lib/private/Route/Router.php @@ -95,7 +95,7 @@ public function __construct(ILogger $logger) { * @return string[] */ public function getRoutingFiles() { - if (!isset($this->routingFiles)) { + if ($this->routingFiles === null) { $this->routingFiles = []; foreach (\OC_APP::getEnabledApps() as $app) { $appPath = \OC_App::getAppPath($app); diff --git a/lib/private/Security/Normalizer/IpAddress.php b/lib/private/Security/Normalizer/IpAddress.php index a679936e20cbe..cbfc212e1ce63 100644 --- a/lib/private/Security/Normalizer/IpAddress.php +++ b/lib/private/Security/Normalizer/IpAddress.php @@ -58,7 +58,7 @@ private function getIPv4Subnet(string $ip, int $maskBits = 32): string { $binary = \inet_pton($ip); for ($i = 32; $i > $maskBits; $i -= 8) { $j = \intdiv($i, 8) - 1; - $k = (int) \min(8, $i - $maskBits); + $k = \min(8, $i - $maskBits); $mask = (0xff - ((2 ** $k) - 1)); $int = \unpack('C', $binary[$j]); $binary[$j] = \pack('C', $int[1] & $mask); @@ -84,7 +84,7 @@ private function getIPv6Subnet(string $ip, int $maskBits = 48): string { $binary = \inet_pton($ip); for ($i = 128; $i > $maskBits; $i -= 8) { $j = \intdiv($i, 8) - 1; - $k = (int) \min(8, $i - $maskBits); + $k = \min(8, $i - $maskBits); $mask = (0xff - ((2 ** $k) - 1)); $int = \unpack('C', $binary[$j]); $binary[$j] = \pack('C', $int[1] & $mask); diff --git a/lib/private/Template/JSConfigHelper.php b/lib/private/Template/JSConfigHelper.php index 69624825ae467..b228cae6ffb33 100644 --- a/lib/private/Template/JSConfigHelper.php +++ b/lib/private/Template/JSConfigHelper.php @@ -207,59 +207,59 @@ public function getConfig() { 'nc_lastLogin' => $lastConfirmTimestamp, 'nc_pageLoad' => time(), "dayNames" => json_encode([ - (string)$this->l->t('Sunday'), - (string)$this->l->t('Monday'), - (string)$this->l->t('Tuesday'), - (string)$this->l->t('Wednesday'), - (string)$this->l->t('Thursday'), - (string)$this->l->t('Friday'), - (string)$this->l->t('Saturday') + $this->l->t('Sunday'), + $this->l->t('Monday'), + $this->l->t('Tuesday'), + $this->l->t('Wednesday'), + $this->l->t('Thursday'), + $this->l->t('Friday'), + $this->l->t('Saturday') ]), "dayNamesShort" => json_encode([ - (string)$this->l->t('Sun.'), - (string)$this->l->t('Mon.'), - (string)$this->l->t('Tue.'), - (string)$this->l->t('Wed.'), - (string)$this->l->t('Thu.'), - (string)$this->l->t('Fri.'), - (string)$this->l->t('Sat.') + $this->l->t('Sun.'), + $this->l->t('Mon.'), + $this->l->t('Tue.'), + $this->l->t('Wed.'), + $this->l->t('Thu.'), + $this->l->t('Fri.'), + $this->l->t('Sat.') ]), "dayNamesMin" => json_encode([ - (string)$this->l->t('Su'), - (string)$this->l->t('Mo'), - (string)$this->l->t('Tu'), - (string)$this->l->t('We'), - (string)$this->l->t('Th'), - (string)$this->l->t('Fr'), - (string)$this->l->t('Sa') + $this->l->t('Su'), + $this->l->t('Mo'), + $this->l->t('Tu'), + $this->l->t('We'), + $this->l->t('Th'), + $this->l->t('Fr'), + $this->l->t('Sa') ]), "monthNames" => json_encode([ - (string)$this->l->t('January'), - (string)$this->l->t('February'), - (string)$this->l->t('March'), - (string)$this->l->t('April'), - (string)$this->l->t('May'), - (string)$this->l->t('June'), - (string)$this->l->t('July'), - (string)$this->l->t('August'), - (string)$this->l->t('September'), - (string)$this->l->t('October'), - (string)$this->l->t('November'), - (string)$this->l->t('December') + $this->l->t('January'), + $this->l->t('February'), + $this->l->t('March'), + $this->l->t('April'), + $this->l->t('May'), + $this->l->t('June'), + $this->l->t('July'), + $this->l->t('August'), + $this->l->t('September'), + $this->l->t('October'), + $this->l->t('November'), + $this->l->t('December') ]), "monthNamesShort" => json_encode([ - (string)$this->l->t('Jan.'), - (string)$this->l->t('Feb.'), - (string)$this->l->t('Mar.'), - (string)$this->l->t('Apr.'), - (string)$this->l->t('May.'), - (string)$this->l->t('Jun.'), - (string)$this->l->t('Jul.'), - (string)$this->l->t('Aug.'), - (string)$this->l->t('Sep.'), - (string)$this->l->t('Oct.'), - (string)$this->l->t('Nov.'), - (string)$this->l->t('Dec.') + $this->l->t('Jan.'), + $this->l->t('Feb.'), + $this->l->t('Mar.'), + $this->l->t('Apr.'), + $this->l->t('May.'), + $this->l->t('Jun.'), + $this->l->t('Jul.'), + $this->l->t('Aug.'), + $this->l->t('Sep.'), + $this->l->t('Oct.'), + $this->l->t('Nov.'), + $this->l->t('Dec.') ]), "firstDay" => json_encode($this->l->l('firstday', null)), "_oc_config" => json_encode($config), diff --git a/lib/private/User/User.php b/lib/private/User/User.php index 24082926b0d94..016f129227f64 100644 --- a/lib/private/User/User.php +++ b/lib/private/User/User.php @@ -66,6 +66,7 @@ class User implements IUser { /** @var UserInterface|null */ private $backend; + /** @var EventDispatcherInterface */ private $legacyDispatcher; @@ -127,23 +128,26 @@ public function getUID() { * * @return string */ - public function getDisplayName() { - if (!isset($this->displayName)) { - $displayName = ''; - if ($this->backend && $this->backend->implementsActions(Backend::GET_DISPLAYNAME)) { - // get display name and strip whitespace from the beginning and end of it - $backendDisplayName = $this->backend->getDisplayName($this->uid); - if (is_string($backendDisplayName)) { - $displayName = trim($backendDisplayName); - } - } + public function getDisplayName(): string { + if ($this->displayName !== null) { + return $this->displayName; + } - if (!empty($displayName)) { - $this->displayName = $displayName; - } else { - $this->displayName = $this->uid; + $displayName = ''; + if ($this->backend && $this->backend->implementsActions(Backend::GET_DISPLAYNAME)) { + // get display name and strip whitespace from the beginning and end of it + $backendDisplayName = $this->backend->getDisplayName($this->uid); + if (is_string($backendDisplayName)) { + $displayName = trim($backendDisplayName); } } + + if (!empty($displayName)) { + $this->displayName = $displayName; + } else { + $this->displayName = $this->uid; + } + return $this->displayName; } diff --git a/lib/public/AppFramework/Db/QBMapper.php b/lib/public/AppFramework/Db/QBMapper.php index 72373ba26c303..79b3701be2a3e 100644 --- a/lib/public/AppFramework/Db/QBMapper.php +++ b/lib/public/AppFramework/Db/QBMapper.php @@ -147,9 +147,7 @@ public function insert(Entity $entity): Entity { * updates an existing entry if duplicate keys are detected * by the database * - * @param Entity $entity the entity that should be created/updated * @psalm-param T $entity the entity that should be created/updated - * @return Entity the saved entity with the (new) id * @psalm-return T the saved entity with the (new) id * @throws \InvalidArgumentException if entity has no id * @since 15.0.0