diff --git a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php index 32dfb72d9c..764c14bafe 100644 --- a/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php +++ b/apps/user_ldap/tests/Integration/ExceptionOnLostConnection.php @@ -96,7 +96,7 @@ class ExceptionOnLostConnection { */ public function setUp() { require_once __DIR__ . '/../../../../lib/base.php'; - \OC_App::loadApps('user_ldap'); + \OC_App::loadApps(['user_ldap']); $ch = $this->getCurl(); $proxyInfoJson = curl_exec($ch); diff --git a/lib/private/Updater.php b/lib/private/Updater.php index 43096e7c1f..727147e090 100644 --- a/lib/private/Updater.php +++ b/lib/private/Updater.php @@ -250,7 +250,7 @@ class Updater extends BasicEmitter { $this->upgradeAppStoreApps(\OC::$server->getAppManager()->getInstalledApps()); // install new shipped apps on upgrade - OC_App::loadApps('authentication'); + OC_App::loadApps(['authentication']); $errors = Installer::installShippedApps(true); foreach ($errors as $appId => $exception) { /** @var \Exception $exception */ @@ -346,7 +346,7 @@ class Updater extends BasicEmitter { if(!isset($stacks[$type])) { $stacks[$type] = array(); } - if (\OC_App::isType($appId, $type)) { + if (\OC_App::isType($appId, [$type])) { $stacks[$type][] = $appId; $priorityType = true; break; diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index c0794cdfa8..f04310041a 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -93,16 +93,16 @@ class OC_App { /** * loads all apps * - * @param string[] | string | null $types + * @param string[] $types * @return bool * * This function walks through the ownCloud directory and loads all apps * it can find. A directory contains an app if the file /appinfo/info.xml * exists. * - * if $types is set, only apps of those types will be loaded + * if $types is set to non-empty array, only apps of those types will be loaded */ - public static function loadApps($types = null) { + public static function loadApps(array $types = []): bool { if (\OC::$server->getSystemConfig()->getValue('maintenance', false)) { return false; } @@ -120,7 +120,7 @@ class OC_App { // prevent app.php from printing output ob_start(); foreach ($apps as $app) { - if ((is_null($types) or self::isType($app, $types)) && !in_array($app, self::$loadedApps)) { + if (($types === [] or self::isType($app, $types)) && !in_array($app, self::$loadedApps)) { self::loadApp($app); } } @@ -268,13 +268,10 @@ class OC_App { * check if an app is of a specific type * * @param string $app - * @param string|array $types + * @param array $types * @return bool */ - public static function isType($app, $types) { - if (is_string($types)) { - $types = array($types); - } + public static function isType(string $app, array $types): bool { $appTypes = self::getAppTypes($app); foreach ($types as $type) { if (array_search($type, $appTypes) !== false) {