Skip to content

Commit b8a8de4

Browse files
committed
fixup! fixup! Fix some tests
1 parent b60b654 commit b8a8de4

5 files changed

Lines changed: 25 additions & 28 deletions

File tree

apps/user_ldap/lib/Group_LDAP.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ public function removeFromGroup(string $uid, string $gid): bool {
13241324
* Gets group details
13251325
*
13261326
* @param string $gid Name of the group
1327-
* @return array
1327+
* @return array{displayName?: string}
13281328
* @throws Exception
13291329
*/
13301330
public function getGroupDetails(string $gid): array {

apps/user_ldap/lib/Group_Proxy.php

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,19 @@
2828
*/
2929
namespace OCA\User_LDAP;
3030

31+
use OCP\Group\Backend\ABackend;
3132
use OCP\Group\Backend\IDeleteGroupBackend;
3233
use OCP\Group\Backend\IGetDisplayNameBackend;
3334
use OCP\Group\Backend\INamedBackend;
35+
use OCP\Group\Backend\IAddToGroupBackend;
36+
use OCP\Group\Backend\ICountUsersBackend;
37+
use OCP\Group\Backend\IGroupDetailsBackend;
38+
use OCP\Group\Backend\IRemoveFromGroupBackend;
39+
use OCP\GroupInterface;
3440

35-
class Group_Proxy extends Proxy implements \OCP\GroupInterface, IGroupLDAP, IGetDisplayNameBackend, INamedBackend, IDeleteGroupBackend {
41+
class Group_Proxy extends Proxy implements GroupInterface, IGroupLDAP,
42+
IGetDisplayNameBackend, IDeleteGroupBackend, ICountUsersBackend, IAddToGroupBackend,
43+
IRemoveFromGroupBackend, IGroupDetailsBackend {
3644
private $backends = [];
3745
private $refBackend = null;
3846

@@ -187,7 +195,7 @@ public function deleteGroup(string $gid): bool {
187195
*
188196
* Adds a user to a group.
189197
*/
190-
public function addToGroup($uid, $gid) {
198+
public function addToGroup(string $uid, string $gid): bool {
191199
return $this->handleRequest(
192200
$gid, 'addToGroup', [$uid, $gid]);
193201
}
@@ -201,7 +209,7 @@ public function addToGroup($uid, $gid) {
201209
*
202210
* removes the user from a group.
203211
*/
204-
public function removeFromGroup($uid, $gid) {
212+
public function removeFromGroup(string $uid, string $gid): bool {
205213
return $this->handleRequest(
206214
$gid, 'removeFromGroup', [$uid, $gid]);
207215
}
@@ -211,20 +219,16 @@ public function removeFromGroup($uid, $gid) {
211219
*
212220
* @param string $gid the internal group name
213221
* @param string $search optional, a search string
214-
* @return int|bool
215222
*/
216-
public function countUsersInGroup($gid, $search = '') {
223+
public function countUsersInGroup(string $gid, string $search = ''): int {
217224
return $this->handleRequest(
218225
$gid, 'countUsersInGroup', [$gid, $search]);
219226
}
220227

221228
/**
222-
* get an array with group details
223-
*
224-
* @param string $gid
225-
* @return array|false
229+
* Get an array with group details
226230
*/
227-
public function getGroupDetails($gid) {
231+
public function getGroupDetails(string $gid): array {
228232
return $this->handleRequest(
229233
$gid, 'getGroupDetails', [$gid]);
230234
}
@@ -276,7 +280,6 @@ public function implementsActions($actions) {
276280
/**
277281
* Return access for LDAP interaction.
278282
*
279-
* @param string $gid
280283
* @return Access instance of Access for LDAP interaction
281284
*/
282285
public function getLDAPAccess($gid) {

apps/user_ldap/lib/Proxy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ abstract protected function walkBackends($id, $method, $parameters);
142142
* @param string $id
143143
* @return Access
144144
*/
145-
abstract public function getLDAPAccess($id);
145+
abstract public function getLDAPAccess($gid);
146146

147147
abstract protected function activeBackends(): int;
148148

build/psalm-baseline.xml

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1885,6 +1885,14 @@
18851885
<code>$lastUpdateCheckTimestamp</code>
18861886
</InvalidScalarArgument>
18871887
</file>
1888+
<file src="apps/user_ldap/lib/AppInfo/Application.php">
1889+
<InvalidArgument occurrences="1">
1890+
<code>'OCA\\User_LDAP\\User\\User::postLDAPBackendAdded'</code>
1891+
</InvalidArgument>
1892+
<TooManyArguments occurrences="1">
1893+
<code>dispatch</code>
1894+
</TooManyArguments>
1895+
</file>
18881896
<file src="apps/user_ldap/ajax/getNewServerConfigPrefix.php">
18891897
<InvalidScalarArgument occurrences="1">
18901898
<code>$ln + 1</code>
@@ -1904,14 +1912,6 @@
19041912
<code>string[]</code>
19051913
</InvalidReturnType>
19061914
</file>
1907-
<file src="apps/user_ldap/lib/AppInfo/Application.php">
1908-
<InvalidArgument occurrences="1">
1909-
<code>'OCA\\User_LDAP\\User\\User::postLDAPBackendAdded'</code>
1910-
</InvalidArgument>
1911-
<TooManyArguments occurrences="1">
1912-
<code>dispatch</code>
1913-
</TooManyArguments>
1914-
</file>
19151915
<file src="apps/user_ldap/lib/Connection.php">
19161916
<ParadoxicalCondition occurrences="1"/>
19171917
</file>
@@ -1931,11 +1931,6 @@
19311931
<code>is_array($list)</code>
19321932
</RedundantCondition>
19331933
</file>
1934-
<file src="apps/user_ldap/lib/Group_Proxy.php">
1935-
<ParamNameMismatch occurrences="1">
1936-
<code>$gid</code>
1937-
</ParamNameMismatch>
1938-
</file>
19391934
<file src="apps/user_ldap/lib/Jobs/Sync.php">
19401935
<InvalidOperand occurrences="2">
19411936
<code>$i</code>
@@ -3671,7 +3666,7 @@
36713666
<code>IGroup::class . '::preDelete'</code>
36723667
<code>IGroup::class . '::preRemoveUser'</code>
36733668
</InvalidArgument>
3674-
<RedundantCondition occurrences="2"/>
3669+
<RedundantCondition occurrences="1"/>
36753670
<TooManyArguments occurrences="6">
36763671
<code>dispatch</code>
36773672
<code>dispatch</code>

lib/private/Group/Database.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
use OCP\Group\Backend\ISetDisplayNameBackend;
4646
use OCP\Group\Backend\INamedBackend;
4747
use OCP\IDBConnection;
48-
use OCP\IUser;
4948
use OCP\IUserManager;
5049

5150
/**

0 commit comments

Comments
 (0)