summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorCôme Chilliet <come.chilliet@nextcloud.com>2023-02-08 08:59:35 +0100
committerCôme Chilliet <come.chilliet@nextcloud.com>2023-03-20 10:19:42 +0100
commitf0bdf2a4cd01c01fc26a2a1b94d942c0f783418e (patch)
treeed50d83c48a3213342a2ded6797c1cf78a9cd8f8 /lib
parent71ed968e34b595bd515db29c25a3af32901cf97c (diff)
downloadnextcloud-server-f0bdf2a4cd01c01fc26a2a1b94d942c0f783418e.tar.gz
nextcloud-server-f0bdf2a4cd01c01fc26a2a1b94d942c0f783418e.zip
Strong type private properties and methods in AppManager
Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
Diffstat (limited to 'lib')
-rw-r--r--lib/private/App/AppManager.php60
1 files changed, 17 insertions, 43 deletions
diff --git a/lib/private/App/AppManager.php b/lib/private/App/AppManager.php
index 0ee8dccaeb7..3799897ffdd 100644
--- a/lib/private/App/AppManager.php
+++ b/lib/private/App/AppManager.php
@@ -70,46 +70,32 @@ class AppManager implements IAppManager {
'prevent_group_restriction',
];
- /** @var IUserSession */
- private $userSession;
-
- /** @var IConfig */
- private $config;
-
- /** @var AppConfig */
- private $appConfig;
-
- /** @var IGroupManager */
- private $groupManager;
-
- /** @var ICacheFactory */
- private $memCacheFactory;
-
- /** @var EventDispatcherInterface */
- private $legacyDispatcher;
-
+ private IUserSession $userSession;
+ private IConfig $config;
+ private AppConfig $appConfig;
+ private IGroupManager $groupManager;
+ private ICacheFactory $memCacheFactory;
+ private EventDispatcherInterface $legacyDispatcher;
private IEventDispatcher $dispatcher;
-
- /** @var LoggerInterface */
- private $logger;
+ private LoggerInterface $logger;
/** @var string[] $appId => $enabled */
- private $installedAppsCache;
+ private array $installedAppsCache = [];
- /** @var string[] */
- private $shippedApps;
+ /** @var string[]|null */
+ private ?array $shippedApps = null;
private array $alwaysEnabled = [];
private array $defaultEnabled = [];
/** @var array */
- private $appInfos = [];
+ private array $appInfos = [];
/** @var array */
- private $appVersions = [];
+ private array $appVersions = [];
/** @var array */
- private $autoDisabledApps = [];
+ private array $autoDisabledApps = [];
/** @var array<string, true> */
private array $loadedApps = [];
@@ -135,7 +121,7 @@ class AppManager implements IAppManager {
/**
* @return string[] $appId => $enabled
*/
- private function getInstalledAppsValues() {
+ private function getInstalledAppsValues(): array {
if (!$this->installedAppsCache) {
$values = $this->appConfig->getValues(false, 'enabled');
@@ -234,12 +220,7 @@ class AppManager implements IAppManager {
}
}
- /**
- * @param string $enabled
- * @param IUser $user
- * @return bool
- */
- private function checkAppForUser($enabled, $user) {
+ private function checkAppForUser(string $enabled, ?IUser $user): bool {
if ($enabled === 'yes') {
return true;
} elseif ($user === null) {
@@ -267,16 +248,9 @@ class AppManager implements IAppManager {
}
}
- /**
- * @param string $enabled
- * @param IGroup $group
- * @return bool
- */
private function checkAppForGroups(string $enabled, IGroup $group): bool {
if ($enabled === 'yes') {
return true;
- } elseif ($group === null) {
- return false;
} else {
if (empty($enabled)) {
return false;
@@ -706,7 +680,7 @@ class AppManager implements IAppManager {
return in_array($appId, $this->shippedApps, true);
}
- private function isAlwaysEnabled($appId) {
+ private function isAlwaysEnabled(string $appId): bool {
$alwaysEnabled = $this->getAlwaysEnabledApps();
return in_array($appId, $alwaysEnabled, true);
}
@@ -715,7 +689,7 @@ class AppManager implements IAppManager {
* In case you change this method, also change \OC\App\CodeChecker\InfoChecker::loadShippedJson()
* @throws \Exception
*/
- private function loadShippedJson() {
+ private function loadShippedJson(): void {
if ($this->shippedApps === null) {
$shippedJson = \OC::$SERVERROOT . '/core/shipped.json';
if (!file_exists($shippedJson)) {