Skip to content

Commit

Permalink
fix default values and type hints for GroupManager::search
Browse files Browse the repository at this point in the history
ints really are ints

Signed-off-by: Robin Appelman <robin@icewind.nl>
  • Loading branch information
icewind1991 committed Feb 7, 2023
1 parent 82498bc commit 5871ca0
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions lib/private/Group/Manager.php
Original file line number Diff line number Diff line change
Expand Up @@ -240,7 +240,7 @@ public function createGroup($gid) {
* @param int $offset
* @return \OC\Group\Group[]
*/
public function search($search, $limit = null, $offset = null) {
public function search(string $search, int $limit = -1, int $offset = 0) {
$groups = [];
foreach ($this->backends as $backend) {
$groupIds = $backend->getGroups($search, $limit, $offset);
Expand All @@ -252,7 +252,7 @@ public function search($search, $limit = null, $offset = null) {
$this->logger->debug('Group "' . $groupId . '" was returned by search but not found through direct access', ['app' => 'core']);
}
}
if (!is_null($limit) and $limit <= 0) {
if ($limit === 0) {
return array_values($groups);
}
}
Expand Down
2 changes: 1 addition & 1 deletion lib/public/IGroupManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ public function createGroup($gid);
* @return \OCP\IGroup[]
* @since 8.0.0
*/
public function search($search, $limit = null, $offset = null);
public function search(string $search, int $limit = -1, int $offset = 0);

/**
* @param \OCP\IUser|null $user
Expand Down

0 comments on commit 5871ca0

Please sign in to comment.