]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix default values and type hints for GroupManager::search
authorRobin Appelman <robin@icewind.nl>
Tue, 7 Feb 2023 16:19:16 +0000 (17:19 +0100)
committerRobin Appelman <robin@icewind.nl>
Thu, 11 May 2023 15:30:01 +0000 (17:30 +0200)
ints really are ints

Signed-off-by: Robin Appelman <robin@icewind.nl>
lib/private/Group/Manager.php
lib/public/IGroupManager.php

index b718afa516828c88bbd0d693ff732c55cb360984..4dde6152275accfc00dd2e5833c72142de87462e 100644 (file)
@@ -240,7 +240,7 @@ class Manager extends PublicEmitter implements IGroupManager {
         * @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);
@@ -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 (!is_null($limit) and $limit <= 0) {
+                       if ($limit === 0) {
                                return array_values($groups);
                        }
                }
index 2e2685eeeb4efae60e151e47e61368967ead88a1..5c41d7e584277a7bb15259090b4d38979fdf8f79 100644 (file)
@@ -101,7 +101,7 @@ interface IGroupManager {
         * @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