revert public interface back to the original types, just cast them before passing the nulls to the backends

Signed-off-by: Robin Appelman <robin@icewind.nl>
pull/36592/head
Robin Appelman 3 years ago
parent 7ad3574d71
commit 13b06ba4e2
No known key found for this signature in database
GPG Key ID: 42B69D8A64526EFB
  1. 10
      lib/private/Group/Manager.php
  2. 6
      lib/public/IGroupManager.php

@ -236,14 +236,14 @@ class Manager extends PublicEmitter implements IGroupManager {
/**
* @param string $search
* @param int $limit
* @param int $offset
* @param ?int $limit
* @param ?int $offset
* @return \OC\Group\Group[]
*/
public function search(string $search, int $limit = -1, int $offset = 0) {
public function search(string $search, ?int $limit = null, ?int $offset = 0) {
$groups = [];
foreach ($this->backends as $backend) {
$groupIds = $backend->getGroups($search, $limit, $offset);
$groupIds = $backend->getGroups($search, $limit ?? -1, $offset ?? 0);
foreach ($groupIds as $groupId) {
$aGroup = $this->get($groupId);
if ($aGroup instanceof IGroup) {
@ -252,7 +252,7 @@ class Manager extends PublicEmitter implements IGroupManager {
$this->logger->debug('Group "' . $groupId . '" was returned by search but not found through direct access', ['app' => 'core']);
}
}
if ($limit === 0) {
if (!is_null($limit) and $limit <= 0) {
return array_values($groups);
}
}

@ -96,12 +96,12 @@ interface IGroupManager {
/**
* @param string $search
* @param int $limit
* @param int $offset
* @param ?int $limit
* @param ?int $offset
* @return \OCP\IGroup[]
* @since 8.0.0
*/
public function search(string $search, int $limit = -1, int $offset = 0);
public function search(string $search, ?int $limit = null, ?int $offset = 0);
/**
* @param \OCP\IUser|null $user

Loading…
Cancel
Save