diff options
author | Christoph Wurst <ChristophWurst@users.noreply.github.com> | 2021-04-28 09:28:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-28 09:28:19 +0200 |
commit | 6a5d89c1ac2e24301b3c7cdc46b7302e26c4d09f (patch) | |
tree | 9bbb31893aef4db98c5729e48ffa444a64621cf8 /lib/private/Updater.php | |
parent | a0583771694b80bab067b51fb3dd98a159a2454f (diff) | |
parent | 8323cbb9e5acb72f5127d95b45d80733cda2e6f2 (diff) | |
download | nextcloud-server-6a5d89c1ac2e24301b3c7cdc46b7302e26c4d09f.tar.gz nextcloud-server-6a5d89c1ac2e24301b3c7cdc46b7302e26c4d09f.zip |
Merge pull request #26758 from J0WI/more-strict
Some more strict_types
Diffstat (limited to 'lib/private/Updater.php')
-rw-r--r-- | lib/private/Updater.php | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 964fd2ad102..8d21161b1f1 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -1,4 +1,7 @@ <?php + +declare(strict_types=1); + /** * @copyright Copyright (c) 2016, ownCloud, Inc. * @copyright Copyright (c) 2016, Lukas Reschke <lukas@statuscode.ch> @@ -95,7 +98,7 @@ class Updater extends BasicEmitter { * * @return bool true if the operation succeeded, false otherwise */ - public function upgrade() { + public function upgrade(): bool { $this->emitRepairEvents(); $this->logAllEvents(); @@ -160,7 +163,7 @@ class Updater extends BasicEmitter { * * @return array allowed previous versions per vendor */ - private function getAllowedPreviousVersions() { + private function getAllowedPreviousVersions(): array { // this should really be a JSON file require \OC::$SERVERROOT . '/version.php'; /** @var array $OC_VersionCanBeUpgradedFrom */ @@ -172,7 +175,7 @@ class Updater extends BasicEmitter { * * @return string Get the vendor */ - private function getVendor() { + private function getVendor(): string { // this should really be a JSON file require \OC::$SERVERROOT . '/version.php'; /** @var string $vendor */ @@ -186,7 +189,7 @@ class Updater extends BasicEmitter { * @param array $allowedPreviousVersions * @return bool */ - public function isUpgradePossible($oldVersion, $newVersion, array $allowedPreviousVersions) { + public function isUpgradePossible(string $oldVersion, string $newVersion, array $allowedPreviousVersions): bool { $version = explode('.', $oldVersion); $majorMinor = $version[0] . '.' . $version[1]; @@ -221,7 +224,7 @@ class Updater extends BasicEmitter { * * @throws \Exception */ - private function doUpgrade($currentVersion, $installedVersion) { + private function doUpgrade(string $currentVersion, string $installedVersion): void { // Stop update if the update is over several major versions $allowedPreviousVersions = $this->getAllowedPreviousVersions(); if (!$this->isUpgradePossible($installedVersion, $currentVersion, $allowedPreviousVersions)) { @@ -296,7 +299,7 @@ class Updater extends BasicEmitter { $this->config->setAppValue('core', 'vendor', $this->getVendor()); } - protected function doCoreUpgrade() { + protected function doCoreUpgrade(): void { $this->emit('\OC\Updater', 'dbUpgradeBefore'); // execute core migrations @@ -312,7 +315,7 @@ class Updater extends BasicEmitter { * * @throws NeedsUpdateException */ - protected function doAppUpgrade() { + protected function doAppUpgrade(): void { $apps = \OC_App::getEnabledApps(); $priorityTypes = ['authentication', 'filesystem', 'logging']; $pseudoOtherType = 'other'; @@ -361,7 +364,7 @@ class Updater extends BasicEmitter { * @return array * @throws \Exception */ - private function checkAppsRequirements() { + private function checkAppsRequirements(): array { $isCoreUpgrade = $this->isCodeUpgrade(); $apps = OC_App::getEnabledApps(); $version = implode('.', Util::getVersion()); @@ -396,7 +399,7 @@ class Updater extends BasicEmitter { /** * @return bool */ - private function isCodeUpgrade() { + private function isCodeUpgrade(): bool { $installedVersion = $this->config->getSystemValue('version', '0.0.0'); $currentVersion = implode('.', Util::getVersion()); if (version_compare($currentVersion, $installedVersion, '>')) { @@ -410,7 +413,7 @@ class Updater extends BasicEmitter { * @param bool $reenable * @throws \Exception */ - private function upgradeAppStoreApps(array $disabledApps, $reenable = false) { + private function upgradeAppStoreApps(array $disabledApps, bool $reenable = false): void { foreach ($disabledApps as $app) { try { $this->emit('\OC\Updater', 'checkAppStoreAppBefore', [$app]); @@ -435,7 +438,7 @@ class Updater extends BasicEmitter { /** * Forward messages emitted by the repair routine */ - private function emitRepairEvents() { + private function emitRepairEvents(): void { $dispatcher = \OC::$server->getEventDispatcher(); $dispatcher->addListener('\OC\Repair::warning', function ($event) { if ($event instanceof GenericEvent) { @@ -459,7 +462,7 @@ class Updater extends BasicEmitter { }); } - private function logAllEvents() { + private function logAllEvents(): void { $log = $this->log; $dispatcher = \OC::$server->getEventDispatcher(); |