aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private
diff options
context:
space:
mode:
authorprovokateurin <kate@provokateurin.de>2024-09-24 15:53:13 +0200
committerprovokateurin <kate@provokateurin.de>2024-11-05 09:58:11 +0100
commit77114fb3277742fc69ddcf2432311ecb263af97e (patch)
tree0f360660038c65acc5f9cd014f183e45b0c5355b /lib/private
parent1140e41db2ef6241f806eb605df48642a2a32c62 (diff)
downloadnextcloud-server-77114fb3277742fc69ddcf2432311ecb263af97e.tar.gz
nextcloud-server-77114fb3277742fc69ddcf2432311ecb263af97e.zip
fix(OpenAPI): Adjust array syntax to avoid ambiguitiesfix/openapi/array-syntax
Signed-off-by: provokateurin <kate@provokateurin.de>
Diffstat (limited to 'lib/private')
-rw-r--r--lib/private/AppConfig.php4
-rw-r--r--lib/private/Files/Template/TemplateManager.php7
-rw-r--r--lib/private/Group/Backend.php2
-rw-r--r--lib/private/Group/Database.php2
-rw-r--r--lib/private/Group/Manager.php4
-rw-r--r--lib/private/OCM/Model/OCMProvider.php12
-rw-r--r--lib/private/OCM/Model/OCMResource.php8
-rw-r--r--lib/private/Search/SearchComposer.php6
-rw-r--r--lib/private/Tags.php6
-rw-r--r--lib/private/Teams/TeamManager.php2
-rw-r--r--lib/private/Updater/ChangesCheck.php2
-rw-r--r--lib/private/legacy/OC_App.php2
12 files changed, 31 insertions, 26 deletions
diff --git a/lib/private/AppConfig.php b/lib/private/AppConfig.php
index 312b6973403..a0e5d7e28e8 100644
--- a/lib/private/AppConfig.php
+++ b/lib/private/AppConfig.php
@@ -76,7 +76,7 @@ class AppConfig implements IAppConfig {
/**
* @inheritDoc
*
- * @return string[] list of app ids
+ * @return list<string> list of app ids
* @since 7.0.0
*/
public function getApps(): array {
@@ -92,7 +92,7 @@ class AppConfig implements IAppConfig {
*
* @param string $app id of the app
*
- * @return string[] list of stored config keys
+ * @return list<string> list of stored config keys
* @since 29.0.0
*/
public function getKeys(string $app): array {
diff --git a/lib/private/Files/Template/TemplateManager.php b/lib/private/Files/Template/TemplateManager.php
index 865af4eb90c..47011f875ae 100644
--- a/lib/private/Files/Template/TemplateManager.php
+++ b/lib/private/Files/Template/TemplateManager.php
@@ -118,11 +118,11 @@ class TemplateManager implements ITemplateManager {
}
public function listTemplates(): array {
- return array_map(function (TemplateFileCreator $entry) {
+ return array_values(array_map(function (TemplateFileCreator $entry) {
return array_merge($entry->jsonSerialize(), [
'templates' => $this->getTemplateFiles($entry)
]);
- }, $this->listCreators());
+ }, $this->listCreators()));
}
/**
@@ -180,6 +180,9 @@ class TemplateManager implements ITemplateManager {
throw new NotFoundException();
}
+ /**
+ * @return list<Template>
+ */
private function getTemplateFiles(TemplateFileCreator $type): array {
$templates = [];
foreach ($this->getRegisteredProviders() as $provider) {
diff --git a/lib/private/Group/Backend.php b/lib/private/Group/Backend.php
index f6844308a15..f4a90018b5a 100644
--- a/lib/private/Group/Backend.php
+++ b/lib/private/Group/Backend.php
@@ -71,7 +71,7 @@ abstract class Backend implements \OCP\GroupInterface {
/**
* Get all groups a user belongs to
* @param string $uid Name of the user
- * @return array an array of group names
+ * @return list<string> an array of group names
*
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
diff --git a/lib/private/Group/Database.php b/lib/private/Group/Database.php
index 095cbe24316..0cb571a3935 100644
--- a/lib/private/Group/Database.php
+++ b/lib/private/Group/Database.php
@@ -194,7 +194,7 @@ class Database extends ABackend implements
/**
* Get all groups a user belongs to
* @param string $uid Name of the user
- * @return array an array of group names
+ * @return list<string> an array of group names
*
* This function fetches all groups a user belongs to. It does not check
* if the user exists at all.
diff --git a/lib/private/Group/Manager.php b/lib/private/Group/Manager.php
index bd46780a602..e58a1fe6585 100644
--- a/lib/private/Group/Manager.php
+++ b/lib/private/Group/Manager.php
@@ -361,7 +361,7 @@ class Manager extends PublicEmitter implements IGroupManager {
* get a list of group ids for a user
*
* @param IUser $user
- * @return string[] with group ids
+ * @return list<string> with group ids
*/
public function getUserGroupIds(IUser $user): array {
return $this->getUserIdGroupIds($user->getUID());
@@ -369,7 +369,7 @@ class Manager extends PublicEmitter implements IGroupManager {
/**
* @param string $uid the user id
- * @return string[]
+ * @return list<string>
*/
private function getUserIdGroupIds(string $uid): array {
if (!isset($this->cachedUserGroups[$uid])) {
diff --git a/lib/private/OCM/Model/OCMProvider.php b/lib/private/OCM/Model/OCMProvider.php
index 9bda95ebc17..73002ae668d 100644
--- a/lib/private/OCM/Model/OCMProvider.php
+++ b/lib/private/OCM/Model/OCMProvider.php
@@ -194,12 +194,12 @@ class OCMProvider implements IOCMProvider {
* enabled: bool,
* apiVersion: string,
* endPoint: string,
- * resourceTypes: array{
- * name: string,
- * shareTypes: string[],
- * protocols: array<string, string>
- * }[]
- * }
+ * resourceTypes: list<array{
+ * name: string,
+ * shareTypes: list<string>,
+ * protocols: array<string, string>
+ * }>,
+ * }
*/
public function jsonSerialize(): array {
$resourceTypes = [];
diff --git a/lib/private/OCM/Model/OCMResource.php b/lib/private/OCM/Model/OCMResource.php
index 68f9ee18f79..3d619db1927 100644
--- a/lib/private/OCM/Model/OCMResource.php
+++ b/lib/private/OCM/Model/OCMResource.php
@@ -16,7 +16,7 @@ use OCP\OCM\IOCMResource;
*/
class OCMResource implements IOCMResource {
private string $name = '';
- /** @var string[] */
+ /** @var list<string> */
private array $shareTypes = [];
/** @var array<string, string> */
private array $protocols = [];
@@ -40,7 +40,7 @@ class OCMResource implements IOCMResource {
}
/**
- * @param string[] $shareTypes
+ * @param list<string> $shareTypes
*
* @return $this
*/
@@ -51,7 +51,7 @@ class OCMResource implements IOCMResource {
}
/**
- * @return string[]
+ * @return list<string>
*/
public function getShareTypes(): array {
return $this->shareTypes;
@@ -92,7 +92,7 @@ class OCMResource implements IOCMResource {
/**
* @return array{
* name: string,
- * shareTypes: string[],
+ * shareTypes: list<string>,
* protocols: array<string, string>
* }
*/
diff --git a/lib/private/Search/SearchComposer.php b/lib/private/Search/SearchComposer.php
index d23662f7055..71fd003717c 100644
--- a/lib/private/Search/SearchComposer.php
+++ b/lib/private/Search/SearchComposer.php
@@ -10,6 +10,7 @@ namespace OC\Search;
use InvalidArgumentException;
use OC\AppFramework\Bootstrap\Coordinator;
+use OC\Core\ResponseDefinitions;
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\Search\FilterDefinition;
@@ -43,6 +44,7 @@ use function array_map;
* results are awaited or shown as they come in.
*
* @see IProvider::search() for the arguments of the individual search requests
+ * @psalm-import-type CoreUnifiedSearchProvider from ResponseDefinitions
*/
class SearchComposer {
/**
@@ -156,7 +158,7 @@ class SearchComposer {
* @param string $route the route the user is currently at
* @param array $routeParameters the parameters of the route the user is currently at
*
- * @return array
+ * @return list<CoreUnifiedSearchProvider>
*/
public function getProviders(string $route, array $routeParameters): array {
$this->loadLazyProviders();
@@ -183,7 +185,7 @@ class SearchComposer {
'name' => $provider->getName(),
'icon' => $this->fetchIcon($appId, $provider->getId()),
'order' => $order,
- 'triggers' => $triggers,
+ 'triggers' => array_values($triggers),
'filters' => $this->getFiltersType($filters, $provider->getId()),
'inAppSearch' => $provider instanceof IInAppSearch,
];
diff --git a/lib/private/Tags.php b/lib/private/Tags.php
index 1f22a4c6a33..d59c1bd6928 100644
--- a/lib/private/Tags.php
+++ b/lib/private/Tags.php
@@ -147,9 +147,9 @@ class Tags implements ITags {
/**
* Get the list of tags for the given ids.
*
- * @param array $objIds array of object ids
- * @return array|false of tags id as key to array of tag names
- * or false if an error occurred
+ * @param list<int> $objIds array of object ids
+ * @return array<int, list<string>>|false of tags id as key to array of tag names
+ * or false if an error occurred
*/
public function getTagsForObjects(array $objIds) {
$entries = [];
diff --git a/lib/private/Teams/TeamManager.php b/lib/private/Teams/TeamManager.php
index 223579a1182..d75b0209c71 100644
--- a/lib/private/Teams/TeamManager.php
+++ b/lib/private/Teams/TeamManager.php
@@ -80,7 +80,7 @@ class TeamManager implements ITeamManager {
array_push($resources, ...$provider->getSharedWith($teamId));
}
- return $resources;
+ return array_values($resources);
}
public function getTeamsForResource(string $providerId, string $resourceId, string $userId): array {
diff --git a/lib/private/Updater/ChangesCheck.php b/lib/private/Updater/ChangesCheck.php
index df017b09040..e88969f62a8 100644
--- a/lib/private/Updater/ChangesCheck.php
+++ b/lib/private/Updater/ChangesCheck.php
@@ -32,7 +32,7 @@ class ChangesCheck {
/**
* @throws DoesNotExistException
- * @return array{changelogURL: string, whatsNew: array<string, array{admin: string[], regular: string[]}>}
+ * @return array{changelogURL: string, whatsNew: array<string, array{admin: list<string>, regular: list<string>}>}
*/
public function getChangesForVersion(string $version): array {
$version = $this->normalizeVersion($version);
diff --git a/lib/private/legacy/OC_App.php b/lib/private/legacy/OC_App.php
index 6afd4086cb3..544938b6ff9 100644
--- a/lib/private/legacy/OC_App.php
+++ b/lib/private/legacy/OC_App.php
@@ -169,7 +169,7 @@ class OC_App {
* @param bool $forceRefresh whether to refresh the cache
* @param bool $all whether to return apps for all users, not only the
* currently logged in one
- * @return string[]
+ * @return list<string>
*/
public static function getEnabledApps(bool $forceRefresh = false, bool $all = false): array {
if (!\OC::$server->getSystemConfig()->getValue('installed', false)) {