aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2024-09-18 11:40:45 +0200
committerJoas Schilling <coding@schilljs.com>2024-09-23 17:07:53 +0200
commit9a91a604140652574991e1cc49784817b2fec3a0 (patch)
treeaa70c1b357f47a87176b14ead552e7abb7ee75bd
parenta46e951eb578c0b5e6b6d6cbcbb0759d3e84f87f (diff)
downloadnextcloud-server-backport/48162/stable30.tar.gz
nextcloud-server-backport/48162/stable30.zip
fix(autocomplete): Move known array keys to psalm docsbackport/48162/stable30
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php10
-rw-r--r--lib/public/Collaboration/AutoComplete/IManager.php6
-rw-r--r--lib/public/Collaboration/AutoComplete/ISorter.php2
3 files changed, 9 insertions, 9 deletions
diff --git a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php
index 733b37811cd..f2c019e4a72 100644
--- a/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php
+++ b/apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php
@@ -109,7 +109,7 @@ class ShareRecipientSorterTest extends TestCase {
]
];
$workArray = $originalArray;
- $this->sorter->sort($workArray, ['itemType' => 'files', 'itemId' => 404]);
+ $this->sorter->sort($workArray, ['itemType' => 'files', 'itemId' => '404']);
$this->assertEquals($originalArray, $workArray);
}
@@ -118,7 +118,7 @@ class ShareRecipientSorterTest extends TestCase {
return [[
[
#0 – sort properly and otherwise keep existing order
- 'context' => ['itemType' => 'files', 'itemId' => 42],
+ 'context' => ['itemType' => 'files', 'itemId' => '42'],
'accessList' => ['users' => ['celia', 'darius', 'faruk', 'gail'], 'bots' => ['r2-d2']],
'input' => [
'users' =>
@@ -155,7 +155,7 @@ class ShareRecipientSorterTest extends TestCase {
],
[
#1 – no recipients
- 'context' => ['itemType' => 'files', 'itemId' => 42],
+ 'context' => ['itemType' => 'files', 'itemId' => '42'],
'accessList' => ['users' => false],
'input' => [
'users' =>
@@ -192,7 +192,7 @@ class ShareRecipientSorterTest extends TestCase {
],
[
#2 – unsupported item type
- 'context' => ['itemType' => 'announcements', 'itemId' => 42],
+ 'context' => ['itemType' => 'announcements', 'itemId' => '42'],
'accessList' => null, // not needed
'input' => [
'users' =>
@@ -229,7 +229,7 @@ class ShareRecipientSorterTest extends TestCase {
],
[
#3 – no nothing
- 'context' => ['itemType' => 'files', 'itemId' => 42],
+ 'context' => ['itemType' => 'files', 'itemId' => '42'],
'accessList' => [],
'input' => [],
'expected' => [],
diff --git a/lib/public/Collaboration/AutoComplete/IManager.php b/lib/public/Collaboration/AutoComplete/IManager.php
index cc586b92d7d..55a1fe5cec3 100644
--- a/lib/public/Collaboration/AutoComplete/IManager.php
+++ b/lib/public/Collaboration/AutoComplete/IManager.php
@@ -18,9 +18,9 @@ interface IManager {
public function registerSorter($className);
/**
- * @param array $sorters list of sorter IDs, separated by "|"
- * @param array $sortArray array representation of OCP\Collaboration\Collaborators\ISearchResult
- * @param array $context context info of the search, keys: itemType, itemId
+ * @param array $sorters list of sorter IDs, separated by "|"
+ * @param array $sortArray array representation of OCP\Collaboration\Collaborators\ISearchResult
+ * @param array{itemType: string, itemId: string, search?: string} $context context info of the search
* @since 13.0.0
*/
public function runSorters(array $sorters, array &$sortArray, array $context);
diff --git a/lib/public/Collaboration/AutoComplete/ISorter.php b/lib/public/Collaboration/AutoComplete/ISorter.php
index 772b1f9c6b9..4b9f2b72e7c 100644
--- a/lib/public/Collaboration/AutoComplete/ISorter.php
+++ b/lib/public/Collaboration/AutoComplete/ISorter.php
@@ -23,7 +23,7 @@ interface ISorter {
* executes the sort action
*
* @param array $sortArray the array to be sorted, provided as reference
- * @param array $context carries key 'itemType' and 'itemId' of the source object (e.g. a file)
+ * @param array{itemType: string, itemId: string, search?: string} $context carries key 'itemType' and 'itemId' of the source object (e.g. a file)
* @since 13.0.0
*/
public function sort(array &$sortArray, array $context);