Skip to content

Commit a0cb795

Browse files
Merge pull request #48162 from nextcloud/bugfix/noid/array-keys
fix(autocomplete): Move known array keys to psalm docs
2 parents 854d54d + 0af0bf3 commit a0cb795

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

apps/files_sharing/tests/Collaboration/ShareRecipientSorterTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ public function testSortNoNodes(): void {
109109
]
110110
];
111111
$workArray = $originalArray;
112-
$this->sorter->sort($workArray, ['itemType' => 'files', 'itemId' => 404]);
112+
$this->sorter->sort($workArray, ['itemType' => 'files', 'itemId' => '404']);
113113

114114
$this->assertEquals($originalArray, $workArray);
115115
}
@@ -118,7 +118,7 @@ public function sortDataProvider() {
118118
return [[
119119
[
120120
#0 – sort properly and otherwise keep existing order
121-
'context' => ['itemType' => 'files', 'itemId' => 42],
121+
'context' => ['itemType' => 'files', 'itemId' => '42'],
122122
'accessList' => ['users' => ['celia', 'darius', 'faruk', 'gail'], 'bots' => ['r2-d2']],
123123
'input' => [
124124
'users' =>
@@ -155,7 +155,7 @@ public function sortDataProvider() {
155155
],
156156
[
157157
#1 – no recipients
158-
'context' => ['itemType' => 'files', 'itemId' => 42],
158+
'context' => ['itemType' => 'files', 'itemId' => '42'],
159159
'accessList' => ['users' => false],
160160
'input' => [
161161
'users' =>
@@ -192,7 +192,7 @@ public function sortDataProvider() {
192192
],
193193
[
194194
#2 – unsupported item type
195-
'context' => ['itemType' => 'announcements', 'itemId' => 42],
195+
'context' => ['itemType' => 'announcements', 'itemId' => '42'],
196196
'accessList' => null, // not needed
197197
'input' => [
198198
'users' =>
@@ -229,7 +229,7 @@ public function sortDataProvider() {
229229
],
230230
[
231231
#3 – no nothing
232-
'context' => ['itemType' => 'files', 'itemId' => 42],
232+
'context' => ['itemType' => 'files', 'itemId' => '42'],
233233
'accessList' => [],
234234
'input' => [],
235235
'expected' => [],

lib/public/Collaboration/AutoComplete/IManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ public function registerSorter($className);
2020
/**
2121
* @param array $sorters list of sorter IDs, separated by "|"
2222
* @param array $sortArray array representation of OCP\Collaboration\Collaborators\ISearchResult
23-
* @param array $context context info of the search, keys: itemType, itemId
23+
* @param array{itemType: string, itemId: string, search?: string} $context context info of the search
2424
* @since 13.0.0
2525
*/
2626
public function runSorters(array $sorters, array &$sortArray, array $context);

lib/public/Collaboration/AutoComplete/ISorter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public function getId();
2323
* executes the sort action
2424
*
2525
* @param array $sortArray the array to be sorted, provided as reference
26-
* @param array $context carries key 'itemType' and 'itemId' of the source object (e.g. a file)
26+
* @param array{itemType: string, itemId: string, search?: string} $context carries key 'itemType' and 'itemId' of the source object (e.g. a file)
2727
* @since 13.0.0
2828
*/
2929
public function sort(array &$sortArray, array $context);

0 commit comments

Comments
 (0)