Skip to content

Commit

Permalink
fix(autocomplete): Move known array keys to psalm docs
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <coding@schilljs.com>
  • Loading branch information
nickvergessen committed Sep 23, 2024
1 parent a46e951 commit 9a91a60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function testSortNoNodes() {
]
];
$workArray = $originalArray;
$this->sorter->sort($workArray, ['itemType' => 'files', 'itemId' => 404]);
$this->sorter->sort($workArray, ['itemType' => 'files', 'itemId' => '404']);

$this->assertEquals($originalArray, $workArray);
}
Expand All @@ -118,7 +118,7 @@ public function sortDataProvider() {
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' =>
Expand Down Expand Up @@ -155,7 +155,7 @@ public function sortDataProvider() {
],
[
#1 – no recipients
'context' => ['itemType' => 'files', 'itemId' => 42],
'context' => ['itemType' => 'files', 'itemId' => '42'],
'accessList' => ['users' => false],
'input' => [
'users' =>
Expand Down Expand Up @@ -192,7 +192,7 @@ public function sortDataProvider() {
],
[
#2 – unsupported item type
'context' => ['itemType' => 'announcements', 'itemId' => 42],
'context' => ['itemType' => 'announcements', 'itemId' => '42'],
'accessList' => null, // not needed
'input' => [
'users' =>
Expand Down Expand Up @@ -229,7 +229,7 @@ public function sortDataProvider() {
],
[
#3 – no nothing
'context' => ['itemType' => 'files', 'itemId' => 42],
'context' => ['itemType' => 'files', 'itemId' => '42'],
'accessList' => [],
'input' => [],
'expected' => [],
Expand Down
6 changes: 3 additions & 3 deletions lib/public/Collaboration/AutoComplete/IManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion lib/public/Collaboration/AutoComplete/ISorter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function getId();
* 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);
Expand Down

0 comments on commit 9a91a60

Please sign in to comment.